从键盘输入3位正整数,分离出个位,十位,百位,并得到最大数
来源:百度知道 编辑:UC知道 时间:2024/05/16 09:02:20
i = InputBox("请输入三个数字")
If Len(i) < 3 Then
MsgBox "你输入的小于三位"
End
End If
nG = CInt(Right(CStr(i), 1))
nS = CInt(Mid(CStr(i), 2, 1))
nB = CInt(Left(CStr(i), 1))
sT = "三位数是:" & i & ";个位是:" & nG & ";十位是:" & nS & ";百位是:" & nB & ";最大数是:"
If nG > nS Then
If nG > nB Then
MsgBox sT & nG
Else
MsgBox sT & nB
End If
Else
If nS > nB Then
MsgBox sT & nS
Else
MsgBox sT & nB
End If
End If