Quantcast
Channel: Programmers Heaven Forums RSS Feed
Viewing all articles
Browse latest Browse all 2703

Help with programming BMI calculator

$
0
0
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 <stdio.h>

int main (void)

{

int wieghtInKilograms;
int heightInMeters;
int bmi;

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

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

Viewing all articles
Browse latest Browse all 2703

Trending Articles