You are on page 1of 1

24 August 2021

Qu1 Write a program to display numbers from 10 to 50

Using For Loop Using Repeat Until Using While Loop


Dim index as integer Dim N as integer Dim I as integer
N = 10 i = 10
For index = 10 to 50 Do Do while I <= 50
Console.writeline ( index ) Console.writeline(N) Console.writeline(i)
Next N=N+1 i=i+1
LOOP UNTIL N > 50 LOOP

Qu2 Write a program to display numbers from 50 to 10


Step is a reserved word/ key word in VB

Dim index as integer Dim N as integer


For index = 50 to 10 step -1 Dim N as integer
Console.writeline (index) N = 50
Next Do N = 50
Console.writeline (N) Do while N >= 10
Dim Index as integer N=N-1 Console.writeline (N)
Dim N as integer LOOP UNTIL N < 10 N=N-1
LOOP
Version Mohamed:
Dim index as integer
Dim num as integer
Num = 50
For index = 1 to 40
Console.writeline (num)
Num = num – 1
Next

Qu3 Write a program to display all numbers multiple of 3 in the range 3 to 81 inclusive.
Dim index as integer
Dim index as integer
For index = 3 to 81 step 3
Index = 3
Console.writeline (index)
Do
Next
Console.writeline (index)
Index = index + 3
Loop until index > 81

You might also like