WAP to display 1st 5 whole numbers using FOR & WHILE Loop. in qbasic
Answers
Answered by
2
The given problem is solved using - QBASIC.
1. Using For Loop:
CLS
FOR I = 0 TO 4
PRINT I;
NEXT I
END
2. Using While Loop:
CLS
I = 0
WHILE I < 5
PRINT I;
I = I + 1
WEND
END
- Whole number start from 0. First five whole numbers are 0, 1, 2, 3, 4.
- Iterate loop from X = 0 to 4 -> Display the value of X.
See attachment for output.
Attachments:
Similar questions
Math,
12 days ago
Biology,
12 days ago
Social Sciences,
25 days ago
English,
8 months ago
Computer Science,
8 months ago
English,
8 months ago