Dim a As Single, b As Single, c As Single
a = Val(Text1)
b = Val(Text2)
c = Round(a / (b * 1.6))
Label6.Caption = c
If Option1.Value Then
If c <20 Then
Label8.Caption = "过轻"
ElseIf c <25 Then
Label8.Caption = "适中"
ElseIf c <30 Then
Label8.Caption = "过重"
ElseIf c <35 Then
Label8.Caption = "肥胖"
ElseIf c >= 35 Then
Label8.Caption = "非常肥胖"
End If
Else
If c <19 Then
Label8.Caption = "过轻"
ElseIf c <24 Then
Label8.Caption = "适中"
ElseIf c <29 Then
Label8.Caption = "过重"
ElseIf c <34 Then
Label8.Caption = "肥消消谨胖"
ElseIf c >= 34 Then
Label8.Caption = "非常肥胖"
End If
End If
End Sub
体质指数(BMI)=体重(kg)÷身高^2(m)
a=val(inputbox("输入隐祥体重"))
b=val(inputbox("输入身高"))
bmi=a/ b^2
msgbox bmi
就四句代码很简单的
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)