This blog is under construction

Monday 8 July 2013

C program to calculate body mass index(BMI)

Write a C program to calculate body mass index(BMI).


  #include <stdio.h>
  #define FEETTOMETER 0.3048
  int main() {
        float weight, height, bmi;

        /* get the input weight from the user */
        printf("Enter your weight(in kgs):");
        scanf("%f", &weight);

        /* get the input height from the user */
        printf("Enter your height(in feet):");
        scanf("%f", &height);

        /* height in meters */
        height = height * FEETTOMETER;

        /* bmi calculation */
        bmi = (weight)/(height * height);

        /* print the result */
        printf("Your Body Mass Index: %f\n", bmi);
        return 0;
  }



  Output:
  jp@jp-VirtualBox:~/$ ./a.out
  Enter your weight(in kgs):88
  Enter your height(in feet):6 
  Your Body Mass Index: 26.311783





See Also:

6 comments:

  1. in the end it close so fast, I cant read information

    ReplyDelete
  2. Enter your height and weight to find your body mass index (BMI) Extra weight can increase your risk for health problems. Bmi Calculator

    بالون المعدة
    بالونات المعدة

    عملية البالون

    ReplyDelete
  3. Body Mass Index doesn't mean a whole lot. It is a ratio of your height to your weight to analyze how large you are. The numbers are used to determine if you are too large for your size, in a healthy range etc. Usually, it is an okay range to go by. However, the problem is that it doesn't account for the differences between weight in muscle and fat.I also have many suggestions about the BMI through this BMI calculator.

    ReplyDelete
  4. There is a error in a program is occure
    Replace the one word return 0 ku replacing a getch() write it the program will executed successfully

    ReplyDelete