#include #include #include #include #include #ifdef complex #undef complex #endif #ifdef I #undef I #endif #if defined(_WIN64) typedef long long BLASLONG; typedef unsigned long long BLASULONG; #else typedef long BLASLONG; typedef unsigned long BLASULONG; #endif /* generate a function to compute BMI status of a person based on their height and weight in SI units */ int bmi(double height, double weight) { double bmi = weight / (height * height); if (bmi < 18.5) { return 0; } else if (bmi < 25.0) { return 1; } else if (bmi < 30.0) { return 2; } else { return 3; } } /* generate a function to collect height & weight in SI units from the user */ int collect_height_weight(double *height, double *weight) { printf("Enter height in meters: "); scanf("%lf", height); printf("Enter weight in kg: "); scanf("%lf", weight); return 0; } /* generate function to convert BMI status to human friendly format */ int status_readable(int status) { if (status == 0) { printf("Underweight\n"); } else if (status == 1) { printf("Normal\n"); } else if (status == 2) { printf("Overweight\n"); } else if (status == 3) { printf("Obese\n"); } return 0; } /* main function */ int main() { double height, weight; int status; collect_height_weight(&height, &weight); status = bmi(height, weight); status_readable(status); return 0; } /* $cc -o bmi bmi.c $./bmi Enter height in meters: 1.73 Enter weight in kg: 66 Normal */