Computer Science, asked by spratyush, 1 month ago

WAP to display table of Entered number in decending order using FOR & WHILE Loop.in qbasic

Answers

Answered by anindyaadhikari13
3

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

Here, we have to display the table of a number in descending order.

1. Using FOR-NEXT loop:

CLS

INPUT "Enter a number: "; A

FOR I = 10 TO 1 STEP -1

   PRINT A; " x "; I; "="; A * I

NEXT I

END

2. Using WHILE loop:

CLS

INPUT "Enter a number: "; A

I = 10

WHILE I > 0

   PRINT A; " x "; I; "="; A * I

   I = I - 1

WEND

END

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

  • Accept a number, say A.
  • Repeat for I = 10 to 1 -> Multiply a with I and display it.

See attachment for output.

Attachments:
Similar questions