Python 程式用於計算你的體重指數(BMI)
我們需要輸入我們的身高和體重。我們的任務是使用公式計算 BMI。
演算法
Step 1: input height and weight of your body. Step 2: then applying the formula for calculation BMI. Step 3: display BMI.
示例程式碼
height = float(input("Enter your height(m): "))
weight = float(input("Enter your weight(kg): "))
print("Your BMI is: ", round(weight / (height * height), 2))
輸出
Enter your height (m): 5.8 Input your weight (kg): 64 Your body mass index is: 1.9
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP