Chapter - 3: The Decision Control

The Body Mass Index (BMI) is defined as the ratio of the weight of a person (in kilograms) to the square of the height (in meters). Write a program that receives weight and height calculates the BMI category as per the following table : Starvation : < 15 Anorexic : 15.1 - 17.5 Underweight : 17.6 - 18.5 Ideal : 18.6 - 24.9 Overweight : 25 - 25.9 Obese : 30 - 30.9 Morbidly Obese : >= 40


G
Sections
13
Exercises
#include<stdio.h>
#include<conio.h>
int main()
{
	float w, h, bmi;
	
	printf("\nEnter you wight (in kg) and height (in m) : ");
	scanf("%f%f", &w, &h);
	
	bmi = w / (h * h);
	
	printf("\nYour BMI category is : ");
	
	if(bmi < 15)
		printf("Starvation.");
		
	if(bmi >= 15.1 && bmi <= 17.5)
		printf("Anorexic.");
		
	if(bmi >= 17.6 && bmi <= 18.5)
		printf("Underweight.");
		
	if(bmi >= 18.6 && bmi <= 24.9)
		printf("Ideal");
		
	if(bmi >= 25 && bmi <= 25.9)
		printf("Overweight.");
		
	if(bmi >= 30 && bmi <= 30.9)
		printf("Obese.");
		
	if(bmi >= 40)
		printf("Morbidly Obese.");
	
	getch();
	return 0;
}

© 2021 Garbage Valuegarbage value logo