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:

4 comments:

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

    ReplyDelete
  2. Calculate your BMI by using our Body mass index Calculator for adults & children. Calculated by dividing the weight in kilograms by the square of height in meters. Weight Calculator

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

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

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

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

    ReplyDelete