Search This Blog

Body Mass Index Calculator Using C Program - C Program to Calculate BMI

Body Mass Index Calculation is based on your weight and height. Body Mass Index (BMI) = weight/(height*height) where weight is in kilograms and height in meters. The following c program takes weight and height as input and displays BMI and grades into underweight,Normal, Overweight or obesity.

#include<stdio.h>;
void main()
{
float w,h,bmi;
printf("Enter weight in kgs and height in meters");
scanf("%f%f",&w,&h);
bmi=w/(h*h);
printf("bmi: %f",bmi);
bmi<18.5?printf("Underweight"):(bmi<25)?printf("Normal weight"):(bmi<30)?printf("Overweight"):printf("Obesity");
}

Calculate your BMI here

Weight (in kg):
Height (in meters):

Related Posts:

C Program to Display Prime Numbers Less than Given Number
C Program to Display Armstrong Numbers
C Program to Check Armstrong Number
C Program to Reverse a Number
C Program for Quick Sort
C Program to Search an element in array (Linear Search)
Leap Year C Program
C Program to Find Sum of Digits of a Number
C Program to Check Perfect Number
C Program to Find Transpose of Matrix
C Program to Understand Bitwise Operators

No comments: