Wir sollen für die schule einen BMI Rechner programieren aber bei mir kommt immer das Gewicht als ergebnis . Thx für die Antworten im Voraus
Code : (mit DEV C++ geschrieben)
include <stdio.h>
include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
float bmi(float l,float m);
int main(int argc, char *argv) {
float l;
float m;
float bmi_;
printf("Geben Sie ihre Koerpergewicht in Kg ein :");
scanf("%f",&m);
printf("Geben sie ihr Koerpergroesse in ein :");
scanf("%f",&l);
bmi_ = bmi(l,m);
printf("%f\n",bmi_);
system("PAUSE");
return 0;
}
float bmi(float l,float m) {
return m/(l*l);
}