From a0f4a7ed25b0fcf19002b1a3f6eafa666fa7fb78 Mon Sep 17 00:00:00 2001 From: amber Date: Wed, 19 Jul 2017 14:17:02 +0000 Subject: [PATCH] bmihw --- bmi.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 bmi.js diff --git a/bmi.js b/bmi.js new file mode 100644 index 0000000..f72bc37 --- /dev/null +++ b/bmi.js @@ -0,0 +1,19 @@ +//吳思嬋 + +var height=163; +var weight=56; + +function getBMI(hei,wei){ + return wei/((hei*hei)/10000); +} + +function getMessage(hei,wei){ + var a=getBMI(hei,wei); + if(a<18.5)console.log("過輕"); + else if(a<=24)console.log("正常"); + else if(a<=30) console.log("輕度胖"); + else if(a<=35)console.log("中度胖"); + else console.log("重度胖"); + +} +getMessage(height,weight);