0
#include<stdio.h>
#include<conio.h>
main()
{
float x,y,z;
clrscr();
printf("\nThis program calculate if you are Underweight,Healthy or Overweight");
printf("\n\n Enter your weight in kilograms:");
scanf("%f",&x);
printf("\n\n Enter your weight in meters:");
scanf("%f",&y);
z=((y*y)/x);
if(z<20){
 printf(" the Quetelet-index is: %f",z);
 printf("\n\n\tUnderweight");
 }
 else{
 printf("\n the quetelet-index is : %f",z);
 printf("\n\n\tOverweight");
 }
 getch();
 return 0;
 }
4
Contributors
4
Replies
5
Views
12 Years
Discussion Span
Last Post by Zababa
0

I can't help you with the math (have no clue what a quetelet is) but you will need to add a getch() immediately following that scanf() to remove the <Enter> key from the keyboard buffer. scanf() does not do that for you.

0

No! No! No! No! No! NO!!!

OK, I didn't know that... Sorry, I have tried it once or twice, and it worked on my compiler... What can I say... I feel ashamed....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.