0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【JavaScript】if文で肥満度(BMI)を測る

Last updated at Posted at 2019-10-14

BMIによって肥満度を測ります。
heightに身長(メートル)、weightに体重(キロ)を入れる。

var height = 1.7;  //身長(m)
var weight = 60;  //体重(kg)

var BMI = weight/height/height;
console.log("BMIは" + BMI + "です");

var Taiju = height*height*22;
console.log("適正体重は" + Taiju + "kgです");


if ( BMI < 18.5) {
	console.log("痩せ気味です");
}
else if ( BMI < 25) {
	console.log("普通です");
}
else if( BMI < 30 ){
	console.log("肥満気味です");
}
else{
	console.log("高度肥満です");
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?