Computer Science, asked by BrainlyProgrammer, 5 months ago

CHALLENGE TO QBASIC CODERS

WAP in QBASIC to print the following pattern

54321
12345
4321
1234
321
123
21
12
1
1​

Answers

Answered by ant717
3

Explanation:

Qbasic using loops and if else

Attachments:
Answered by anindyaadhikari13
3

Question:-

➡ Write a program in QBASIC to display the following pattern.

54321

12345

4321

1234

321

123

21

12

1

1

Program:-

This is the shortest code.

CLS

INPUT "ENTER THE NUMBER OF ROWS: ",N

C=N

A=N, B=-1

FOR I=1 TO 2*N STEP 1

FOR J=1 TO C STEP 1

PRINT A+" "

A=A+B

NEXT J

B=B*-1

A=A+B

PRINT

IF I MOD 2=0 THEN

C=C-1

A=C

END IF

NEXT I

END

Similar questions