回覆列表
-
1 # Sunny魯寧
-
2 # 吃了個大瓜
dim i as long
dim sum as long
sum=0
for i=1 to 100 step 2
sum=sum+i
next i
print sum
dim i as long
dim sum as long
sum=0
for i=1 to 100 step 2
sum=sum+i
next i
print sum
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