11+ C BMI Calculator Programs

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


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);
           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.
int main()
	float hgt;
	float wgt;
	printf(" . .... ..... Simple BMI Calculator ..... .... .\n\n   Enter your height(in cms.)  :  ");
	printf("\n   Enter your weight(in kg)  :  ");
	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");
	return 0;

3. BMI Calculator by Kishore kumar

Made by Kishore kumar. Source


/* Input your weight your height in meters */

#include <stdio.h>
int main() 
    int weight;
    float height,x;
    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


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");
 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


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);


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:

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.

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:");

printf("\n\nEnter only the foot value from your height:");

printf("\n\nEnter only the inch value from your height:");   

// BMI math :

// 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. ");

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:");

printf("\n\n\nEnter 1 if your are male and 2 if female:");      

printf("\n\n\nEnter your average physical work-hour per day:");

// BMR math :
else if(gender==2)

// 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๐Ÿ•ต.");



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);
    printf ("\nYour Body Mass Index is %.1f",BMI);
        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? 


What is your height in meters? 


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


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
int main()
    double w,h,b;
    printf("\t\t  Calculate your BMI");
   printf("\n\n\t  Enter Your Height (in meter): ");
   printf("\n\n\t  Enter your weight (in kilogram): ");
    printf("\n \n\t   This is your BMI %f%",b);
        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");
        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 ?
height in cm ?
BMI is 21.51
#include <stdio.h>

int main()
	float weight=70.0f;
	printf("weight in kg ?");

	float height=1.77f;
	printf("height in cm ?");

	//10 to 18.4 : underweight
	//18.5 to 24.9 : normal
	//25 to 29.9 : overweight
	//over 30 : obesity
	float bmi;
	printf("BMI is %.2f",bmi);
  printf("please follow me.thank you");

	return 0;