write programs in queue basic for the following
to print the odd number from 1 to 20 using FOR.......NEXT
PLEASE GIVE ANSWER STEP BY STEP
Answers
Answered by
1
Question:-
Write a program in QBASIC to print odd numbers from 1 to 20 using FOR NEXT STATEMENT
Program:-
First method.
CLS
FOR I=1 TO 20 STEP 1
IF I MOD 2=1 THEN
PRINT I
END IF
NEXT I
Another method.
CLS
FOR I=1 TO 20 STEP 2
PRINT I
NEXT I
Writing line numbers is optional. You may or may not write line numbers.
Similar questions