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

Recommended Answers

All 4 Replies

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.

Yes, but fflush(stdin); will do as well...

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....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.