/* calculates actual bmi */ void calculate(GtkToggleButton * button, gpointer data) { g_print("\n%f", height); g_print("\n%d", weight); bmi = calc_bmi(weight, height, factor); g_print("\n %f", bmi); }
int main(void){ double weight, height, bmi; //variables for height, weight, and bmi. printf("Please enter your weight in pounds: "); scanf("%lf", &weight); //Gets user's weight printf("\nPlease enter your height in inches: "); scanf("%lf", &height); // Gets user's height bmi = calc_bmi(height, weight); //Calls the function "calc_bmi" and stores the result in the variable 'bmi' if(bmi < 18.5) printf("\nA BMI of %.1lf is considered underweight\n", bmi); if( (bmi >= 18.5) && (bmi < 25) ) printf("\nA BMI of %.1lf is considered normal\n", bmi); if( (bmi >= 25.0) && (bmi < 30) ) printf("\nA BMI of %.1lf is considered overweight\n", bmi); if(bmi >= 30.0) printf("\nA BMI of %.1lf is considered obese\n", bmi); system("pause"); return 0; }