Could you please tell me what is wrong with my code?
I recently learned how to use if - else statements and I'm getting an error here like crazy.
Building weighthight.obj.
C:\Users\Deimler\Desktop\C Programing\New folder\weighthight.c(20): error #2001: Syntax error: expected ')' but found 'integer constant'.
C:\Users\Deimler\Desktop\C Programing\New folder\weighthight.c(20): error #2001: Syntax error: expected ';' but found ')'.
C:\Users\Deimler\Desktop\C Programing\New folder\weighthight.c(20): error #2061: Illegal statement termination.
C:\Users\Deimler\Desktop\C Programing\New folder\weighthight.c(23): error #2157: Unrecognized statement.
C:\Users\Deimler\Desktop\C Programing\New folder\weighthight.c(23): error #2001: Syntax error: expected ';' but found 'if'.
C:\Users\Deimler\Desktop\C Programing\New folder\weighthight.c(26): error #2039: Illegal expression.
C:\Users\Deimler\Desktop\C Programing\New folder\weighthight.c(26): error #2088: Lvalue required.
C:\Users\Deimler\Desktop\C Programing\New folder\weighthight.c(26): error #2001: Syntax error: expected ')' but found 'floating constant'.
C:\Users\Deimler\Desktop\C Programing\New folder\weighthight.c(26): warning #2030: = used in a conditional expression.
C:\Users\Deimler\Desktop\C Programing\New folder\weighthight.c(26): error #2001: Syntax error: expected ';' but found ')'.
C:\Users\Deimler\Desktop\C Programing\New folder\weighthight.c(26): error #2061: Illegal statement termination.
C:\Users\Deimler\Desktop\C Programing\New folder\weighthight.c(29): error #2157: Unrecognized statement.
C:\Users\Deimler\Desktop\C Programing\New folder\weighthight.c(29): error #2001: Syntax error: expected ';' but found '('.
C:\Users\Deimler\Desktop\C Programing\New folder\weighthight.c(30): error #2001: Syntax error: expected ';' but found 'printf'.
*** Error code: 1 ***
Done.
Here's my code.
#include <stdio.h>
#include <math.h>
int
main()
{
double bmi;
double h;
double w;
printf("What is your height in Inches -> ");
scanf("%lf", &h);
printf("What is your weight in lb -> ");
scanf("%lf", &w);
bmi = (703 * w) / (h * h);
printf( "The bmi is %f ", bmi);
if (bmi <= 18. 5)
printf ("Your BMI is %f you are -> Underweight\n", bmi);
else if (18.5 <= bmi <= 24.9)
printf ("Your BMI is %f you are -> Normal\n", bmi);
else if (25.0 <=bmi=<29.9)
printf ("Your BMI is %f you are -> Overweight\n", bmi);
else (bmi >= 30.0)
printf (" Your BMI is %f you are -> Obese\n", bmi);
return 0;
}
Hope you can help, its driving me crazy.