Write program in QBASIC to
display
of all ever number from 1 to 50 wing for - Next
loop.
Answers
Answered by
2
Required Answer:-
Question:
- Write a program in QBASIC to display all even numbers from 1 to 50 using for next loop.
Solution:
Here is the program.
10 CLS
20 FOR I = 1 TO 50
30 IF I MOD 2 = 0 THEN
40 PRINT I + " "
50 END IF
60 NEXT I
70 END
Explanation:
- We are asked to display all the even numbers using for next loop. We will create a loop that iterates from I = 1 to 50. If the value of 'I' is even, then it will print the value of 'I'
Similar questions