Closed roberthsu2003 closed 9 months ago
#include <iostream>
#include <math.h>
using namespace std;
int main() {
double kg ,cm;
cout << "請輸入您的身高(公分):";
cin >> cm;
cout << "請輸入您的體重(公斤):";
cin >> kg;
cout << "您的BMI:"<< kg/pow(cm/100,2);
}
#include <iostream>
using namespace std;
int main() {
double heigth, weight, bmi;
cout << "輸入身高(公尺)" << endl;
cin >> heigth;
cout << "輸入體重" << endl;
cin >> weight;
bmi = weight / (heigth / 100 * heigth / 100);
cout << "你的bmi是" << bmi << endl;
}
#include <iostream>
using namespace std;
int main() {
double in1,in2,max;
cout << "請輸入您的身高(公分):";
cin >> in1;
cout << "請輸入您的體重(公斤):";
cin >> in2;
in1/=100;
max = in2/(in1*in1);
cout << "您的BMI:" << max << "\n";
return 0;
}
#include <iostream>
using namespace std;
int main() {
double h, w, BMI;
cout << "請輸入您的身高(公分):";
cin >> h;
cout << "請輸入您的體重(公斤):";
cin >> w;
BMI = w / ((h / 100.0) * (h / 100.0));
cout << "您的BMI為:" << BMI << endl;
return 0;
}
#include <iostream>
#include <math.h>
using namespace std;
int main() {
double a,b,area;
cout<<"請輸入你的身高(m):";
cin>>a;
cout<<"請輸入你的體重(kg):";
cin>>b;
area=b/(a*a);
cout<<"您的BMI值為:"<<area<<endl;
}
#include <iostream>
using namespace std;
int main() {
double height;
double weight;
double bmi;
cout<<"請輸入您的身高(公分):";
cin>>height;
cout<<"請輸入您的體重(公斤):";
cin>>weight;
height/=100;
bmi=weight/(height*height);
cout<<"您的BMI為:"<<bmi;
}
#include <iostream>
#include <math.h>
using namespace std;
double BMI(double weight, double height) {
double result = weight / pow(height, 2);
return result;
}
int main() {
double weight,height;
cout<<"請輸入體重(Kg):";
cin>>weight;
cout<<"請輸入身高(m):";
cin>>height;
double result=BMI(weight,height);
cout<<"BMI為:"<<result<<endl;
}
請計算使用者的BMI