WAP to display 1st 5 even natural numbers in reverse order using FOR & WHILE Loop.
Answers
Answered by
2
The given problem is solved using - QBASIC.
1. Using For Loop:
CLS
A = 2
FOR I = 5 TO 1 STEP -1
PRINT 2 * I;
NEXT I
END
2. Using While Loop:
CLS
A = 2
I = 5
WHILE I > 0
PRINT 2 * I;
I = I - 1
WEND
END
- Iterate loop For X = 5 to 1.
- Display the value of 2X.
See attachment for output.
Attachments:
Similar questions