Friday, March 28, 2014

BMI Calculator

#include<stdio.h>
#include<stdlib.h>
void line()
{
int i,j;
printf("\n");
for(i=1;i<=42;i++)
printf("=");
}
void header()
{
printf("\n");
printf("Built and Designed by Arslan Malik\n\n www.CworldbyAS.blogspot.com");
printf("\n");
}
int main()
{
line();
header();
line();
    float w,h;
    float bmi;
    printf("Weight in Kilograms : ");
    scanf("%f",&w);
    printf("\nHeight in Meters : ");
    scanf("%f",&h);
    printf("BMI = %.1f\n",w/(h*h));
    if (bmi<18.5)
    {
        printf("Underweight");
    }
    if (bmi>=18.5 && bmi<=24.9)
    {
        printf("Normal");
    }
    if (bmi>=25 && bmi<=29.9)
    {
        printf("Overweight");
    }
    if (bmi>=30)
    {
        printf("Obese");
    }
    printf("\n\n-----BMI Value Range-----");
    printf("\nUnderweight : less than 18.5 \nNormal : between 18.5 & 24.9\nOverweight : between 25 & 29.9\nObese : 30 or greater");


return 0;
}

No comments:

Post a Comment