fork download
  1. #include"stdio.h"
  2. #include"conio.h"
  3. float weight_kg,height_m,BMI;
  4. main()
  5. {
  6. printf("Enter weight_kg: ");
  7. scanf("%f",&weight_kg);
  8. printf("Enter height_m: ");
  9. scanf("%f",&height_m);
  10. if(height_m <=0)
  11. printf("Error: height > 0");
  12. BMI = weight_kg/(height_m*height_m);
  13. printf("BMI : %.1f\n",BMI);
  14. printf("result: ");
  15. if (BMI < 18.5)
  16. printf("Underweight");
  17. else if (BMI <= 24.9)
  18. printf("Normal weight");
  19. else if (BMI <= 29.9)
  20. printf("Overweight");
  21. else
  22. printf("Obesity");
  23. getch();
  24. }
Success #stdin #stdout 0.03s 25676KB
stdin
Standard input is empty
stdout
#include"stdio.h"
#include"conio.h"
float weight_kg,height_m,BMI;
main()
{
	printf("Enter weight_kg: ");
	scanf("%f",&weight_kg);
	printf("Enter height_m: ");
	scanf("%f",&height_m);
	if(height_m <=0)
	   printf("Error: height > 0");
	BMI = weight_kg/(height_m*height_m);
	printf("BMI : %.1f\n",BMI);
	printf("result: ");
	if (BMI < 18.5)
	    printf("Underweight");
	else if (BMI <= 24.9)
	    printf("Normal weight");
	else if (BMI <= 29.9)
	    printf("Overweight");
	else 
	    printf("Obesity");
	getch();
}