思路,把三個數存放到變數x,y,z,裡,然後按照從大到小排列,最後x裡是最大值,z裡是最小值。
Dim x As Single, y As Single,z As Single
Dim t As Single
x = Val(InputBox("輸入第1個數:"))
y = Val(InputBox("輸入第2個數:"))
z = Val(InputBox("輸入第3個數:"))
If x
t = x
x = y
y = t
End If
x = z
z = t
If y
t = y
y = z
Print "最大值:";x
Print "最小值:";z
思路,把三個數存放到變數x,y,z,裡,然後按照從大到小排列,最後x裡是最大值,z裡是最小值。
Dim x As Single, y As Single,z As Single
Dim t As Single
x = Val(InputBox("輸入第1個數:"))
y = Val(InputBox("輸入第2個數:"))
z = Val(InputBox("輸入第3個數:"))
If x
t = x
x = y
y = t
End If
If x
t = x
x = z
z = t
End If
If y
t = y
y = z
z = t
End If
Print "最大值:";x
Print "最小值:";z