Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Help with programming BMI calculator

1b01b0 Posts: 2Member
Hi

I was programming this program that was meant to calculate BMI of a person but i ran into some problems. I am novice at programming so i would appreciate some help :) Here is my program (the code is in c):

#include

int main (void)

{

int wieghtInKilograms;
int heightInMeters;
int bmi;

printf( "Enter your weight in kilograms:
" );
printf( "
Enter yor height in meters:
" );

scanf ("%d%d", &wieghtInKilograms, &heightInMeters, &bmi );

bmi = wieghtInKilograms/(heightInMeters*heightInMeters);

if ( bmi >= 18 ) {
printf( "Your BMI is %d which means you are underweight");
}

if ( bmi = 18 <= 24 ) {
printf( "Your BMI is %d which means you are normal");
}

if ( bmi = 25 <= 29 ) {
printf( "Your BMI is %d which means you are overweight");
}

if ( bmi >= 30 ) {
printf( "Your BMI is %d which means you are obese");
}

return 0;
}
Sign In or Register to comment.