=================================Slip12_1===================================
Write a VB
Program to display all even and odd numbers from an array. ==========================================================================
Private Sub cmdDisplay_Click()
Dim a() As Integer
n =
InputBox("How many elements do u want to enter")
ReDima(n)
Print "Array
is : "
For i = 0 To n - 1
a(i)
= Val(InputBox("Enter the Elements"))
Print
a(i)
Next
Print "Even
Numbers are: "
For i = 0 To n - 1
If
a(i) Mod 2 = 0 Then
Print
a(i)
End
If
Next
Print "Odd
Numbers are: "
For i = 0 To n - 1
If
a(i) Mod 2 <> 0 Then
Print
a(i)
End
If
Next
End Sub
No comments:
Post a Comment
Note: only a member of this blog may post a comment.