Script for to Print Even numbers
For i=1 To 20
If i mod 2=0 Then
MsgBox i
End if
Next
OutPut - 2,4,6,8,10,12,14,16,18,20
or
For i=20 To 1 Step-1
If i mod 2=0 Then
a=a&" "&i&vbCrLf
End if
Next
MsgBox a
Print odd numbers
For i=1 To 20
If i mod 2<>0 Then
Print i
End if
Next
Out Put- 1,3,5,7,9,11,13,15,17,19
Read the Array values at once
Dim myarray(3)
myarray(0)="Raja"
myarray(1)="Ravi"
myarray(2)="Sunil"
myarray(3)="Mahe"
MsgBox myarray(0)
For i=0 To UBound(myarray)
MsgBox myarray(i)
a=a&myarray(i)&vbcrlf
Next
MsgBox a
Output-
Raja
Ravi
Sunil
Mahe
For i=1 To 20
If i mod 2=0 Then
MsgBox i
End if
Next
OutPut - 2,4,6,8,10,12,14,16,18,20
or
For i=20 To 1 Step-1
If i mod 2=0 Then
a=a&" "&i&vbCrLf
End if
Next
MsgBox a
Print odd numbers
For i=1 To 20
If i mod 2<>0 Then
Print i
End if
Next
Out Put- 1,3,5,7,9,11,13,15,17,19
Read the Array values at once
Dim myarray(3)
myarray(0)="Raja"
myarray(1)="Ravi"
myarray(2)="Sunil"
myarray(3)="Mahe"
MsgBox myarray(0)
For i=0 To UBound(myarray)
MsgBox myarray(i)
a=a&myarray(i)&vbcrlf
Next
MsgBox a
Output-
Raja
Ravi
Sunil
Mahe