fork download
  1. #include<stdio.h>
  2. int main(){
  3. float kg;
  4. printf("enter weight(kg): ");
  5. scanf("%f",&kg);
  6. float cm;
  7. printf("enter height(cm): ");
  8. scanf("%f",&cm);
  9. float m = cm/100;
  10.  
  11. float bmi = kg/(m*m);
  12.  
  13. printf("Based on the information provided, your weight is %.2f kg, and your height is %.2f cm, resulting in a BMI of %.2f.",kg,cm,bmi);
  14. return 0;
  15. }
  16.  
  17.  
  18.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
enter weight(kg): enter height(cm): Based on the information provided, your weight is 0.00 kg, and your height is 0.00 cm, resulting in a BMI of inf.