Computer Science, asked by srijabatabyal7, 2 months ago

8. Write a programin QBASICtogenerate the pattern given below
1
12
123
1234​

Answers

Answered by anindyaadhikari13
5

Answer:

This is the required QBASIC program for the question.

CLS

A = 0

FOR I = 1 TO 5

   A = A * 10 + I

   PRINT A

NEXT I

END

Algorithm:

  1. Initialise a=0
  2. Iterate a loop in the range 1 to 5.
  3. Multiply the value of a by 10 and add the value of the loop variable to it.
  4. Display the value of a with a new line.

Refer to the attachment for output.

•••♪

Attachments:
Answered by BrainlyProgrammer
12

Answer:

There are 2 ways to write this...

Method 1: Using 2 loops

CLS

FOR I=1 TO 4

FOR J=1 TO I

PRINT J

NEXT J

PRINT

NEXT I

END

Method 2: Using only 1 loop

CLS

A=1

FOR I=1 TO 4

PRINT A

A=A*10+I

END

Similar questions