7-21 new fat formula
The Evening News reports official Twitter, obesity latest calculated as: square weight (kg) / height (m) is. If more than 25, you are fat. So this question to ask you to write a program to automatically determine a person in the end be considered fat.
Input formats:
Input gives two positive numbers in a row, followed by a person's weight (in kg) and height (in m), separated by a space therebetween. Wherein the weight does not exceed 1000 kg, height does not exceed 3.0 m.
Output formats:
First, the person's weight and output height calculation results are substituted into the formula of obesity, retained after a decimal point. If this value is greater than 25, in the second line of the output PANG
, or outputs Hai Xing
.
Sample Input 1:
100.1 1.74
Output Sample 1:
33.1
PANG
Sample Input 2:
65 1.70
Output Sample 2:
22.5
Hai Xing
1. Note that body weight (kg) / height squared (m) is the square of the denominator is not the square of the ratio, I started wrong.
2. Retain output formats to one decimal.
#include<iostream>
using namespace std;
int main(){
double d1,d2,sum;
cin>>d1>>d2;
sum=d1/(d2*d2);
printf("%.1f\n",sum);
if(sum>25) cout<<"PANG";
else cout<<"Hai Xing";
}