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
3
Explanation:
Qbasic using loops and if else
Attachments:
Answered by
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
IF I MOD 2=0 THEN
C=C-1
A=C
END IF
NEXT I
END
Similar questions
Biology,
2 months ago
Math,
2 months ago
Math,
2 months ago
Chemistry,
4 months ago
Social Sciences,
4 months ago
Biology,
9 months ago
Computer Science,
9 months ago
Math,
9 months ago