How to calculate the body mass index (BMI) in C

1 Answer

0 votes
#include <stdio.h>
#include <string.h>
 
float BMI(float weight, float height) {
   return weight /(height * height);  
}

int main() {
   float weight = 100.00; // kg
   float height = 1.95; // meter
   float bmi = BMI(weight, height);
   
   printf("BMI index is : %.2f\n", bmi);
   
   return 0;
}
          
            
            
            
/*
run:
            
26.30
         
*/

 



answered Jul 13, 2020 by avibootz
...