This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
year = io.read() | |
function junishi(y) | |
data = {"申","酉","戌","亥","子","丑","寅","卯","辰","巳","午","未"} | |
return print(data[year % 12]) | |
end | |
junishi(year) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = io.read() | |
function hanbetu(n) | |
if(n % 2 == 0) then print "even" | |
else print "odd" | |
end | |
end | |
hanbetu(n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cm = io.write() | |
function convert(cm) | |
h = cm / 13 | |
return print(string.format("ハンバーガー %.2f個分 くらいかな?", h)) | |
end | |
convert(cm) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
int i, j; | |
for (i=1; i<=9; i++) { | |
for (j = 1; j <=9; j++) { | |
printf("%d * %d = %d\n", i, j, i*j); | |
} | |
puts(""); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
printf("Hello World!"); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h = io.read(*d) | |
w = io.read(*d) | |
function measurement(w, h) | |
bmi = w / (h * h) | |
print(string.format("%.2f", bmi)) | |
if bmi < 18.5 then | |
print "低体重" | |
elseif 18.5 <= bmi or bmi > 25 then | |
print "普通" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i = 1, 9 do | |
for j = 1, 9 do | |
io.write(string.format("%-3d", i * j)) | |
end | |
print "" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function second() | |
second = 86400 - (os.date("%H") * 3600 + os.date("%M") * 60 + os.date("%S") * 1) | |
return print(second) | |
end | |
print "明日までの時間(秒)" | |
second() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = io.read() | |
y = io.read() | |
z = io.read() | |
function sum2(x, y, z) | |
if z == "+" then | |
print(x .. z .. y .. "=" .. x + y) | |
elseif z == "-" then | |
print(x .. z .. y .. "=" .. x - y) | |
elseif z == "*" then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function omikuzi() | |
t = {"大吉","中吉","小吉", "吉", "凶", "大凶"} | |
i = math.random(#t) | |
print(t[i]) | |
end | |
omikuzi() |
NewerOlder