문제
https://www.acmicpc.net/problem/6825
해결방법
입력은 몸무게(w), 키(h) 순이며 w / (h * h)로 bmi를 구해 조건에 따라 출력한다.
코드
#include<iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
double h, w;
cin >> w >> h;
double bmi = w / (h*h);
if (bmi > 25)
cout << "Overweight";
else if (bmi < 18.5)
cout << "Underweight";
else
cout << "Normal weight";
return 0;
}
'PS > 백준' 카테고리의 다른 글
[C++] 백준 27890: 특별한 작은 분수 (1) | 2023.05.16 |
---|---|
[C++] 백준 5358: Football Team (0) | 2023.05.15 |
[C++] 백준 25784: Easy-to-Solve Expressions (0) | 2023.05.13 |
[C++] 백준 6887: Squares (0) | 2023.05.12 |
백준 18698: The Walking Adam (0) | 2023.05.11 |
댓글