Programming 8 (final)

Today, in economics, we discussed about health in developing countries and obesity in developed countries. This is one of the global issues today, so I created a program to calculate the Body Mass Index (BMI) to help people identify their BMI.

I employed all of the techniques learnt throughout the project e.g. if, printf, scanf.




Additional learning outcomes
Engaged with issues of global importance – obesity and underweight in the world


Source Code:
#include <stdio.h>

int main(void)
{
double a, b;
puts("Body Mass Index Calculator");
puts("Enter your weight and height");
printf("Weight:"); scanf("%lf", &a);
printf("Height (m):"); scanf("%lf", &b);

printf("Your BMI – %.1f",  a/(b*b));

if(a/(b*b) < 18.5)
puts("Underweight");
else if(a/(b*b) >= 25)
puts("Obese");
else
puts("Normal range");

return(0);
}

0 件のコメント:

コメントを投稿