Skip to content

Instantly share code, notes, and snippets.

@kaworun
Created February 7, 2013 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaworun/4732661 to your computer and use it in GitHub Desktop.
Save kaworun/4732661 to your computer and use it in GitHub Desktop.
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 "普通"
elseif 25 <= bmi or bmi > 30then
print "肥満 ⅰ"
elseif 30 <= bmi or bmi > 35 then
print "肥満 ⅱ"
elseif 35 <= bmi or bmi > 40 then
print "肥満 ⅲ"
elseif 40 <= bmi then
print "肥満 ⅳ"
end
end
io.write "あなたのBMIは "
measurement(w, h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment