|
@ -1,9 +1,17 @@ |
|
|
#include <stdio.h> |
|
|
#include <stdio.h> |
|
|
|
|
|
|
|
|
|
|
|
float calcBMI(float a, float b){ |
|
|
|
|
|
if(a > 0 && b > 0) |
|
|
|
|
|
return b / (a * a); |
|
|
|
|
|
else |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
int run_bmi() |
|
|
int run_bmi() |
|
|
{ |
|
|
{ |
|
|
float var1 = 0; |
|
|
float var1 = 0; |
|
|
float var2 = 0; |
|
|
float var2 = 0; |
|
|
|
|
|
float var3 = 0; |
|
|
|
|
|
|
|
|
printf("\nBMI-Rechner\n\nGeben Sie ihre Groesse in m an(Bsp: 1.8): "); |
|
|
printf("\nBMI-Rechner\n\nGeben Sie ihre Groesse in m an(Bsp: 1.8): "); |
|
|
scanf("%f", &var1); |
|
|
scanf("%f", &var1); |
|
@ -11,5 +19,7 @@ int run_bmi() |
|
|
printf("\nGeben Sie ihr Gewicht in kg an: "); |
|
|
printf("\nGeben Sie ihr Gewicht in kg an: "); |
|
|
scanf("%f", &var2); |
|
|
scanf("%f", &var2); |
|
|
|
|
|
|
|
|
printf("\nIhr Body-Mass-Index liegt bei %.2f\n", var2 / (var1 * var1)); |
|
|
|
|
|
|
|
|
var3 = calcBMI(var1, var2); |
|
|
|
|
|
|
|
|
|
|
|
printf("\nIhr Body-Mass-Index liegt bei %.2f\n", var3); |
|
|
} |
|
|
} |