void setup(){
float weight = 50;
float heightCentimeter = 169;
float bmi = cal_bmi(weight,heightCentimeter);
println("bmi="+bmi);
println("weight="+weight);
println("height="+heightCentimeter);
}
float cal_bmi(float weight, float heightCentimeter)
{
float heightMeter; //ความสูง(เมตร)
float bmi; //ค่าดัชนีมวล
heightMeter = heightCentimeter/100;
bmi = weight/(heightMeter*heightMeter);
return bmi;
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น