C language) How fat am I?? -->Let's check out BMI(Body Mass Index) using C language~!

Hi guys~~
 
I'm lulu:-)
 
Today I'm going to make a program that calculates our BMI.
 
#include <stdio.h>
int  main()
{
 double  weight, height;  //Declare variables to store our weight, height.
 double  bmi;  //declare bariable to store our bmi.
 printf("Input your weight(kg) : "); 
 scanf("%lf", &weight);  //store the input weight in variable 'weight'
 printf("Input your tall(cm) : ");
 scanf("%lf", &height);  //store the input height in variable 'height'.
 height = height / 100;  //bmi uses "meter", so we should change to meter.
 bmi = weight / (height * height);  //This is the formula of calculating BMI.
 printf("Your BMI is : %.1lf\n", bmi);
 if (bmi >= 20.0 && bmi < 25.0)
  printf("Standard weight.\n");
 else if (bmi < 20)
  printf("Under weight.\n");
 else
  printf("Over weight.\n");
 return 0;
}
 
 
This way, we can easily know our BMI.
 
If you have any questions or opinions, tell me you'll be welcomed :-)

Comments

Popular posts from this blog

C언어) C언어를 이용하여 평균 구하기~!!

파이썬) 파이썬으로 사칙연산 계산기 만들기~!!

C언어) C언어를 이용하여 나의 BMI 측정하기(저체중, 표준체중, 과체중) 여러분도 직접 비만도를 측정해보세요~!!