Link Exchange
- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -
จากโจทย์จากในกระทู้ http://www.sourcecode.in.th/wbread.php?no=3273เป็นการเขียนโปรแกรม BMI คำนวณดัชนีมวลกายซึ่งจากข้อมูลไม่พบวิธีการคำนวณ จึงได้ค้นหาสูตรคำนวณ ได้ข้อมูลดังนี้BMI Weight CategoryUnder 18.5 Underweight18.5- 24.9 Healthy Weight25 - 29.9 Overweight30 or over Obese
/* @Author:Mr.Suppakit Thongdee @Website: www.sourcecode.in.th */ #include <stdio.h> #include <conio.h> void main(){ float iHeight; float iWeight; float h; float bmi; clrscr(); printf("Program: Body Mass Index (BMI) Calculator\n"); printf("-----------------------------------------\n"); //Input printf("Input height (cm):"); scanf("%f",&iHeight); printf("Input weight (kg):"); scanf("%f",&iWeight); //Calculate h = iHeight/100; bmi = iWeight/(h*h); //Output printf("BMI = %.2f\n",bmi); printf("-----------------------------------------\n"); printf("Weight Category: "); if(bmi<18.5){ printf("Underweight"); }elseif(bmi<=24.9){ printf("Healthy Weight"); }elseif(bmi<=29.9){ printf("Overweight"); }else{ printf("Obese"); } getch(); }
Home - Article - Tutorial - Sourcecode - Dev Handbook - Search - WebBoard - Links - About Us