Algorithm/CodeUp
1229 : 비만도 측정 2
B2SIC
2020. 4. 8. 22:48
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include <stdio.h> int main(void) { double height = 0.0; double weight = 0.0; double standardWeight = 0.0; // 표준몸무게 double pIndex = 0.0; // 비만도 scanf("%lf %lf", &height, &weight); if (height < 150) standardWeight = height - 100; else if (height >= 160) standardWeight = (height - 100) * 0.9; else standardWeight = (height - 150) / 2 + 50; pIndex = (weight - standardWeight) * 100 / standardWeight; if (pIndex <= 10) printf("정상"); else if (pIndex > 20) printf("비만"); else printf("과체중"); return 0; } | cs |