วันพุธที่ 19 สิงหาคม พ.ศ. 2558

[LAB1-Exercise] Calculate body mass index (BMI)

float W=50 ; //Weight
float h=180 ; //Height(cm)
float H ; //Height^2
float BMI ; //BMI
float ht ; //Height(m)
void setup()
{
 //Calculate
 ht = h / 100.00;
 H =  sq(ht) ;
 BMI = W/H;
 
  //Value Weight and Height
 println("Weight =" +W ,"kg");
 println("Height =" +h ,"cm");
 println("Height =" +ht ,"m");

 //Answer BMI
 println("BMI =" +BMI);
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น