This post contains a total of 11+ C BMI Calculator Program Examples with Source Code. All these BMI ( Body mass index ) Calculator Programs are made using C Programming Language.
You can use the source code of these examples with credits to the original owner.
Related Posts
C BMI Calculator Programs
1. BMI Calculator by Monkey D. Luffy
Made by Monkey D. Luffy. Source
80 5.5 Your bmi is 28.47 !! its overweight .Try loosing it by exercise
#include <stdio.h>
//In first input add your weight(kg);
//In second input add your height (feets);
int main() { //the purpouse of this code is to calculate anyone's BMI(body mass index)
float weight;
float height;
scanf(" %f",&weight);
scanf(" %f",&height);
float h = ((height*12*2.54)/100)*((height*12*2.54)/100);
float bmi= weight / h ;
printf ("Your bmi is %.2f \n \n",bmi);
if(bmi<18.5){
printf ("Sorry! You are underweighted ");
}
else if(bmi>=18.5&& bmi<=24.9){
printf ("Congrats! You are having healthy weight :)");
}
else if(bmi>=25&& bmi<=29.9){
printf ("!! its overweight .Try loosing it by exercise");
}
else if(bmi>=30&& bmi<=34.9){
printf ("Sorry to say that , you need to go on diet ,you have overweight :(");
}
else if(bmi>=35&& bmi<=39.9){
printf ("Take care of your weight , you are moderately obese .Take a proper diet");
}
else if(bmi>=40){//Thanx
printf ("OMG! There is need to worry you are severly obese .Get ready for workout");
}
return 0;
}
2. BMI Calculator by MarsMan
Made by MarsMan. Source
. .... ..... Simple BMI Calculator ..... .... . Enter your height(in cms.) : 165 Enter your weight(in kg) : 50 Your Body Mass Index (BMI) is : 18.365473 You are Underweight.
#include<stdio.h>
int main()
{
float hgt;
float wgt;
printf(" . .... ..... Simple BMI Calculator ..... .... .\n\n Enter your height(in cms.) : ");
scanf("%f",&hgt);
printf("\n Enter your weight(in kg) : ");
scanf("%f",&wgt);
float bmi = wgt/(hgt*hgt)*10000;
printf("\n Your Body Mass Index (BMI) is : %f \n\n",bmi);
printf("\n \n");
if (bmi<18.5){
printf(" You are Underweight.\n\n Advice : \n โขEat more frequently.\n โขExercise\n โขChoose Nutrient-rich food\n");
}
if (bmi>=18.5 & bmi <25){
printf(" You are normal and healthy.\n");
}
if (bmi>=25 & bmi<30){
printf(" You are overweight.\n\n Advive :\n โขDrink coffee and tea.\n โขEat soluble fiber.\n โขAvoid Sugary and fruit juice.\n โขDrink water before meals.\n");
}
if (bmi>=30){
printf(" You are obese.\n \n\n Advice :\n โขEngage in regular physical activity and exercise.\n โขStay positive\n");
}
printf("\n\n\n");
return 0;
}
3. BMI Calculator by Kishore kumar
Made by Kishore kumar. Source
60 1.6 Normal
/* Input your weight your height in meters */
#include <stdio.h>
int main()
{
int weight;
float height,x;
scanf("%d",&weight);
scanf("%f",&height);
x = weight /(height * height);
if (x<18.5)
printf ("Underweight");
else if (x>=18.5 && x<25)
printf ("Normal");
else if (x>=25 && x<30)
printf ("Overweight");
else if (x>30)
printf ("Obesity");
return 0;
}
4. Simple BODY MASS INDEX calculator
Made by Aung Chan-Nyein. Source
Enter Your Weight in Pounds :=> 120 Enter Your Heigh in feet :=> 5.5 Your BMI Value is= 19.366392 BMI VALUES ========== You are Normal. Maintain you weight
#include <stdio.h>
int main()
{
float weight,heigh,bmi,height;
printf("Enter Your Weight in Pounds :=>\t");
scanf("%f", &weight);
printf("Enter Your Heigh in feet :=>\t");
scanf("%f\n\n",& heigh); // heigh in feet
height= 12*heigh; // heigh in inches
bmi = ((weight*703 )/(height*height));
printf(" Your BMI Value is=\t %f\n\n\n",bmi );
puts("BMI VALUES");
puts("==========\n");
if ((bmi >= 16) && (bmi <= 18.5))
printf("You Are Underweight!! You need to Eat more! \n\n");
if ((bmi >18.5) && (bmi <=25))
printf("You are Normal. Maintain you weight\n\n");
if ((bmi > 25) && (bmi > 40))
printf(" You are over weight!! damn body:3\n\n");
if (bmi< 16)
printf("You Are Underweight!! You need to Eat more! \n\n");
puts(" * ");
puts(" *** ");
puts(" ******* ");
puts(" ********* ");
puts(" ***** ***** ");
puts(" ********* ");
puts(" ******* ");
puts(" *** ");
puts(" * * ");
puts(" * * ");
puts(" * * ");
puts(" * * ");
puts(" * * ");
puts(" * * ");
puts(" *** ");
}
5. C BMI calculator by Beehive
Made by Beehive. Source
1.6 55 Your BMI is 21.48 You have normal weight
/*please put your height in meter and weight in kg*/
#include <stdio.h>
int main() {
float height,weight,bmi;
scanf ("%f",&height);
scanf("%f",&weight);
bmi= weight/(height*height);
printf("Your BMI is %.2f\n", bmi);
if (bmi<18.5)
{
printf("You are underweight\n");
}
else if (bmi>=18.5&&bmi<=24.99)
{
printf ("You have normal weight\n");
}
else if (bmi>=25&&bmi<=29.99)
{
printf ("Overweight\n");
}
else if (bmi>=30&&bmi<=34.99)
{
printf("Class 1 obesity\n");
}
else if (bmi>=35&&bmi<=39.99)
{
printf("Class 2 obesity\n");
}
else if (bmi>=40)
{
printf("Class 3 obesity\n");
}
else if (bmi>50)
printf("Morbid obesity\n");
return 0;
}
6. BMI & BMR calculator
Made by Saalif. Source
Enter your weight: 50 Enter only the foot value from your height: 5 Enter only the inch value from your height: 5 Your BMI is: 18.343232 You are not fit๐. Eat more and more healthy food๐๐๐ and gain some weight.
#include<stdio.h>
int main()
{double age,weight,foot,inch,work,bmi,bmr,gender,height;
// BMI inputs and computings :
printf("To know your BMR, enter the followings.\n\n");
printf("Enter your weight:");
scanf("%lf",&weight);
printf("\n\nEnter only the foot value from your height:");
scanf("%lf",&foot);
printf("\n\nEnter only the inch value from your height:");
scanf("%lf",&inch);
// BMI math :
height=(foot*30.48+inch*2.54)/100;
bmi=weight/height/height;
// BMI results :
printf("\n\nYour BMI is: %lf \n\n",bmi);
if(bmi>0 && bmi<=18.5)
printf("You are not fit๐. Eat more and more healthy food๐๐๐ and gain some weight.");
else if(bmi>18.5 && bmi<25)
printf("Your body is in perfect fittness. Enjoy it.๐๐\n\n");
else if(bmi>=25 && bmi<30)
printf("You have eccesive fat๐. Lose it a little๐.");
else if(bmi>=30 && bmi<35)
printf(" You are on first stage of being fat๐. Do exercise๐ถ๐ and select healthy food๐๐๐ to eat. ");
else if(bmi>=35 && bmi<40)
printf("You are on second stage of being fat๐ฏ.More and more exercise๐๐
๐ช and healthy food๐๐๐ is needed.");
else if(bmi>=40 && bmi<=100)
printf("You are very fat๐ฅ.You have a risk of death for it๐คฎ๐ต๐ต.Regular exercise๐๐
๐ช and a healhty diet๐๐ is needed. ");
else
printf("\n\nPlease check if the input is ok or not.๐ต๐ต๐ต");
// BMR inputs and computings :
printf("\n\n\n\n\n\nTo get your BMR:โโโ \n\nEnter your age:");
scanf("%lf",&age);
printf("\n\n\nEnter 1 if your are male and 2 if female:");
scanf("%lf",&gender);
printf("\n\n\nEnter your average physical work-hour per day:");
scanf("%lf",&work);
// BMR math :
if(gender==1)
{
bmr=66+(13.7*weight)+(5*height*100)-(6.8*age);
}
else if(gender==2)
bmr=655+(9.6*weight)+(1.8*height*100)-(4.7*age);
// BMR results:
printf("\n\n\nYour BMR is: %lf\n\n\n\n",bmr);
if(work>0 && work<=1)
printf("You need to eat food๐๐๐ of %lf kilo-calorie, everyday.\n\n",bmr*1.2);
else if(work>1 && work<2.5)
printf("You need to eat food๐๐๐ of %lf kilo-calorie, everyday.",bmr*1.375);
else if(work>=2.5 && work<4)
printf("You need to eat food๐๐๐ of %lf kilo-calorie, everyday.",bmr*1.55);
else if(work>=4 && work<6.5)
printf("You need to eat food๐๐๐ of %lf kilo-calorie, everyday.",bmr*1.725);
else if(work>=6.5 && work<=10)
printf("You need to eat food๐๐๐ of %lf kilo-calorie, everyday.",bmr*1.9);
else if(work>10 && work<=14)
printf("You need to work a less and take rest often๐ด๐ to keep yourself healthy.");
else if(work>14 || work<0)
printf("Are you sure about your work- time?๐ง Please check๐ต.");
printf("\n\n\n\n");
}
7. BMI calculator by Lokesh Yadav
Made by Lokesh Yadav. Source
Enter your name : Me Enter your weight in kg : 70 kg Enter your hieght in metres : 165.000 m Your Body Mass Index is 0.0 You are underweight.
#include <stdio.h>
/*To calculate Body Mass Index (BMI)*/
/*Enter your Name Weight Height*/
int main() {
int weight;float height,BMI;char name[16];
printf ("Enter your name : ");
scanf ("%s",name);
printf ("%s\n",name);
printf ("Enter your weight in kg : ");
scanf ("%d",&weight);
printf ("%d kg\n",weight);
printf ("Enter your hieght in metres : ");
scanf ("%f",&height);
printf ("%.3f m\n",height);
BMI=weight/(height*height);
printf ("\nYour Body Mass Index is %.1f",BMI);
if(BMI>=30){
printf ("\nYou are obese.");
}else if(BMI<30 && BMI>=25){
printf ("\nYou are overweight.");
}else if(BMI<25 && BMI>=18.5){
printf ("\nCongratulations,You are in healthy range.");
}else if(BMI<18.5){
printf ("\nYou are underweight. ");
}
return 0;
}
8. Console BMI Calculator
Made by William Owens. Source
What is your weight in kilograms? 60 What is your height in meters? 1.6 Your body mass index (BMI) is 23.44 You are within normal weight according to BMI Your ideal weight is between 64.00kg and 76.80kg.
/*BMI Calulator done in standard C
**This can be refactored to be alot shorter
**Also contains magic numbers.
*/
#include <stdio.h>
int main (void)
{
float weight = 0.0f;
float height = 0.0f;
float bmi = 0.0f;
puts("What is your weight in kilograms? ");
scanf("%f", &weight);
puts("What is your height in meters? ");
scanf("%f", &height);
bmi = weight / (height * height);
printf("\nYour body mass index (BMI) is %.2f\n", bmi);
if(bmi < 18.5)
{
puts("\nYou are underweight according to BMI.\n");
} else if(bmi < 25)
{
puts("\nYou are within normal weight according to BMI\n");
} else if(bmi < 30)
{
puts("\nYou are considered overweight according to BMI\n");
} else
{
puts("\nYou are considered obese according to BMI\n");
}
float ideal_weight_min = (height * height) * 25;
float ideal_weight_max = (height * height) * 29.9999;
printf("Your ideal weight is between %.2fkg and %.2fkg.\n", ideal_weight_min, ideal_weight_max);
}
9. BMI Index Calculator
Made by Chris Yoo. Source
55 1.65 Underweight = <18.5 Normal Weight = 18.5 to 24.9 Overweight = 25 to 29.9 Obesity = BMI of 30 or greater Your BMI index is 20.20 kg/m^2. Therefore, you are at a Normal Weight.
/*
Please enter your weight in kg: e.g. 45.5
Please enter your height under the weight: e.g. 1.75
*/
#include <stdio.h>
int main() {
float weight, height, res1, res2;
scanf("%f", &weight);
scanf("%f", &height);
res1 = weight / height;
res2 = res1 / height;
printf("Underweight = <18.5\n");
printf("Normal Weight = 18.5 to 24.9\n");
printf("Overweight = 25 to 29.9\n");
printf("Obesity = BMI of 30 or greater\n \n");
printf("Your BMI index is %4.2f kg/m^2.\n \n", res2);
if (res2 < 18.5) {
printf("Therefore, you are Underweight.");
}
if (res2 >= 18.5 && res2 < 25) {
printf("Therefore, you are at a Normal Weight.");
}
if (res2 >= 25 && res2 < 30) {
printf("Therefore, you are Overweight.");
}
if (res2 >= 30) {
printf("Therefore, you are Obese.");
}
return 0;
}
10. BMI Calculator by Nazim Hossain
Made by Nazim Hossain. Source
Calculate your BMI Enter Your Height (in meter): 1.6 Enter your weight (in kilogram): 80 This is your BMI 31.250000 You're Obese
#include<stdio.h>
int main()
{
double w,h,b;
printf("\t\t Calculate your BMI");
printf("\n\n\t Enter Your Height (in meter): ");
scanf("%lf",&h);
printf("\n\n\t Enter your weight (in kilogram): ");
scanf("%lf",&w);
b=w/(h*h);
printf("\n \n\t This is your BMI %f%",b);
if(b<18.5)
{
printf("\n\n\t\tYou're Underweight");
}
else if(b>=18.5 && b<=24.9)
{
printf("\n\n\t\tYou're Healthy");
}
else if(b>=25 && b<=29.9)
{
printf("\n\n\t\tYou're Overweight");
}
else if(b>=30 && b<=34.9)
{
printf("\n\n\t\tYou're Obese");
}
else if(b>=35 && b<=39.9)
{
printf("\n\n\t\tYou're Extremely Obese");
}
else
{
printf("\n\n\t\tYou fat!");
}
}
11. Simple BMI Calculator
Made by Abrar. Source
55 5.5 Your BMI is:1.818182
#include <stdio.h>
int main()
{
float w,h;
scanf("%f %f",&w,&h);
printf("Your BMI is:%f",w/(h*h));
return 0;
}
12. BMI Calculator by Felix Thian
Made by Felix Thian. Source
weight in kg ? 60 height in cm ? 167 BMI is 21.51
#include <stdio.h>
int main()
{
float weight=70.0f;
printf("weight in kg ?");
scanf("%f",&weight);
float height=1.77f;
printf("height in cm ?");
scanf("%f",&height);
//10 to 18.4 : underweight
//18.5 to 24.9 : normal
//25 to 29.9 : overweight
//over 30 : obesity
float bmi;
bmi=weight/(height*height/10000.0f);
printf("BMI is %.2f",bmi);
printf("please follow me.thank you");
return 0;
}