bmi.c 550 Bytes
#include <stdio.h>
int main() {
int weight = 0;
int feet = 0;
int inch = 0;
double height = 0.0;
double kilogram = 0.0;
double BMI = 0.0;
printf("Your weight in pounds: ");
scanf("%d", &weight);
printf("Your height in feet and inches, e.g. 5'10\": ");
scanf("%d'%d\"", &feet, &inch);
height = (feet * 12 + inch) * 0.0254;
kilogram = weight / 2.20462;
BMI = kilogram / (height * height);
printf("You are %.2f m tall, weigh %.2f kg, and have BMI %.2f. Perfect!\n", height, kilogram, BMI);
return 0;
}