Saturday, August 25, 2018

BMI INDEX

  • Problem Description

    Write a program that computes the body mass index (BMI) of an individual. 

    Your program should begin by reading a height and weight from the user. If you read the height in meters and the weight in kilograms then body mass index is computed using this slightly simpler formula:

    BMI = weight / height height

    Use %0.2f in the final output value
  • CODING ARENA
  • #include <stdio.h>
    int main()
    {
      float a,b,c;
      scanf("%f %f",&a,&b);
      c=b/(a*a);
      printf("The BMI IS %.2f",c);

    return 0;
    }
  • Test Case 1

    Input (stdin)
    1.69
    
    64
    
    
    Expected Output
    The BMI IS 22.41
  • Test Case 2

    Input (stdin)
    0
    
    
    Expected Output
    0

No comments:

Post a Comment