# 作業 10/06 ## BMI ```python= print("計算BMI") #告訴目的 weight=input("請輸入體重(公斤)") #取得體重 height=input("請輸入身高(公分)") #取得身高 weight=int(weight) #為計算改變資料型態 height=int(height) #為計算改變資料型態 heightm=height/100 #換算身高 height2=heightm*heightm #BMI計算 BMI=weight/height2 #BMI計算 print('BMI為',round(BMI, 2)) #印出結果 print('身高為',height,'公分') #印出結果 print('體重為',weight,'公斤') #印出結果 ```  --- ## 四則運算 ```python= a=input("請輸入第一個整數") #取得第一個整數 b=input("請輸入第二個整數") #取得第二個整數 print('a+b=',int(a)+int(b)) #作加法並印出結果 print('a-b=',int(a)-int(b)) #作減法並印出結果 print('a*b=',int(a)*int(b)) #作乘法並印出結果 print('a/b=',round(int(a)/int(b),2)) #作除法四捨五入到第二位並印出結果 ``` 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up