Computer Science, asked by kishoresharma123456, 3 months ago

Write a VB program to display even numbers between 1 to 21.​

Answers

Answered by yugbhandari7
2

Answer:

Module Module1

   Sub Main()

 

       Dim num, even(100), odd(100), e, o As Integer

 

       Console.WriteLine(" Even Odd  Number From 1 to 50 = ")

 

       e = -1

       o = -1

       num = 1

 

           While num <= 21

 

               If num Mod 2 = 0 Then

               e += 1

               even(e) = num

           Else

               o += 1

               odd(o) = num

 

           End If

           num += 1

       End While

 

           Console.WriteLine(" Even Numbers:  ")

           While e >= 0

 

               Console.WriteLine(" " & even(e))

               e -= 1

           End While

 

           Console.WriteLine(" Odd Numbers:  ")

       While o >= 0

 

           Console.WriteLine(" " & odd(o))

               o -= 1

       End While

 

       Console.ReadKey()

 

   End Sub

 

End Module

Similar questions