判斷奇偶數的vb程序段?
vb程序段如下:
Private Sub Command1_Clicko
If Val(Text1.Text)Mod 2 = 1 And Val(Text1.Text)= Int(Val(Text1.Text)Then
Label1.Caption="這是奇數"
Else
If Val(Text1.Text)Mod 2= 0 And Val(Text1.Text)= Int(Val(Text1.Text))Then
Label1.Caption ="這是偶數"
Else
Label1.Caption ="非奇非偶"
End If
End If
End Sub