Computer Science, asked by dibyeshbanerjee, 6 hours ago

wap to accept your name and print in 10 times using qbasic

Answers

Answered by anindyaadhikari13
1

\texttt{\textsf{\large{\underline{Solution}:}}}

The given problem is solved using language - QBASIC.

1. Using for loop.

CLS

INPUT "Enter your name: "; A$

FOR I = 1 TO 10

   PRINT A$

NEXT I

END

2. Using while loop.

CLS

INPUT "Enter your name: "; A$

I = 1

WHILE I <= 10

   PRINT A$

   I = I + 1

WEND

END

3. Using do-while loop.

CLS

INPUT "Enter your name: "; A$

I = 1

DO

   PRINT A$

   I = I + 1

LOOP WHILE I <= 10

END

\texttt{\textsf{\large{\underline{Explanation}:}}}

  • The question asked is very simple. We have to take the name of the user as input. Then we will iterate a loop 10 times. The print statement is included in loop so that the name is displayed ten times.

See attachment for output.

Attachments:
Similar questions