WAP to display even numbers from 1 to 19 using FOR & While Loop qbasic
Home
/
WAP to display even numbers from 1 to 19 using FOR & While Loop qbasic
WAP to display even numbers from 1 to 19 using FOR & While Loop qbasic
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
[tex]\texttt{\textsf{\large{\underline{Solution}:}}}[/tex]
The given problem is solved using QBASIC.
1. Using For Loop:
CLS
FOR I = 1 TO 19
IF I MOD 2 = 0 THEN
PRINT I;
END IF
NEXT I
END
2. Using While Loop:
CLS
I = 1
WHILE I < 20
IF I MOD 2 = 0 THEN
PRINT I;
END IF
I = I + 1
WEND
END
[tex]\texttt{\textsf{\large{\underline{Logic}:}}}[/tex]
See attachment for output.