#51820: c++正解跟思路 (想學再點)


yp11451032@yphs.tp.edu.tw (711-23吳嘉恩)

學校 : 不指定學校
編號 : 312870
來源 : [203.72.178.2]
最後登入時間 :
2025-10-09 17:59:35

#include<iostream>
#include <iomanip>//才能用 fixed 、setprecision
using namespace std;
int main(){
double h;//宣告(浮點數)
int w;//宣告
while (cin >> w>>h){//重複輸入
cout <<  fixed << setprecision(1) <<w/(h*h)<< endl;// fixed 四捨五入 ,setprecision(1)表小數點後一位
}
}

//BMI算法  體重/(身高次方)