Here is my code for a bmi calculator. I would like to add a question on the end that asks if the user wants to calculate another bmi or that the user wants to stop. I would like to have this question with a y or n answer.
- y = calculate another bmi
- n = goodbye
My code so far:
#include<stdio.h>;
void main()
{
float w,h,bmi;
printf("vul uw gewicht in in kilogram.");
scanf("%f",&w);
printf("vul uw hoogte in in meters. (bijvoorbeeld: 1.75)");
scanf("%f",&h);
bmi=w/(h*h);
printf("bmi: %f",bmi);
bmi<18.5?printf(" je bent best wel dun eet een burger :p"):(bmi<25)?printf(" lekker gewicht, blijf zo doorgaan"):(bmi<30)?printf(" ik zou wat minder gaan eten als ik jou was"):printf("Oh Oh, u bent in gevaar");
}