Help with programming BMI calculator

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;
}

Comments

  • [quote]
    I was programming this program that was meant to calculate BMI of a person but i ran into some problems.[/quote]
    Such as?

Sign In or Register to comment.

Howdy, Stranger!

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

Categories

In this Discussion