#include <stdio.h>
char n[20];
float w,h,BMI;
main()
{
printf ("Welcome to program calculate BMI \n");
printf ("Body Mass Index Program");
printf ("Input your name : ");
scanf ("%s",&n);
printf ("Weight(kg.): ");
scanf ("%f",&w);
printf ("Heigth(m.): ");
scanf ("%f",&h);
BMI = w/(h*h);
printf("Hi! %s. You have BMI. = %.2f",n,BMI);
if(BMI>40)
{ printf ("you are very very fat. It dangerous.");
printf ("You should to eat vegetable and fruit.");
printf ("You should exercise regulary.");
}
else if (BMI>35)
{ printf ("You are very very portly.");
printf ("You should to eat vegetable and fruit.");
printf ("You should exercise sometimes.");
}
else if (BMI>28.5)
{ printf ("You are very very plump.");
printf ("You should to eat vegetable and fruit.");
printf ("You should mini exercise.");
}
else if (BMI>23)
{ printf ("You are chubby.");
printf ("You are healty.");
printf ("You can eat clean food.");
}
else if (BMI>18)
{ printf ("You are slim.");
printf ("You can eat everything.");
printf ("You should exercise.");
}
else
{ printf ("You are very very thin.");
printf ("You should to eat very much.");
printf ("You should exercise.");
}
getch();
}
ใครพอแปลง code ให้เป็น Flowchart ได้ครับ ช่วยที พรีสสส...
char n[20];
float w,h,BMI;
main()
{
printf ("Welcome to program calculate BMI \n");
printf ("Body Mass Index Program");
printf ("Input your name : ");
scanf ("%s",&n);
printf ("Weight(kg.): ");
scanf ("%f",&w);
printf ("Heigth(m.): ");
scanf ("%f",&h);
BMI = w/(h*h);
printf("Hi! %s. You have BMI. = %.2f",n,BMI);
if(BMI>40)
{ printf ("you are very very fat. It dangerous.");
printf ("You should to eat vegetable and fruit.");
printf ("You should exercise regulary.");
}
else if (BMI>35)
{ printf ("You are very very portly.");
printf ("You should to eat vegetable and fruit.");
printf ("You should exercise sometimes.");
}
else if (BMI>28.5)
{ printf ("You are very very plump.");
printf ("You should to eat vegetable and fruit.");
printf ("You should mini exercise.");
}
else if (BMI>23)
{ printf ("You are chubby.");
printf ("You are healty.");
printf ("You can eat clean food.");
}
else if (BMI>18)
{ printf ("You are slim.");
printf ("You can eat everything.");
printf ("You should exercise.");
}
else
{ printf ("You are very very thin.");
printf ("You should to eat very much.");
printf ("You should exercise.");
}
getch();
}