Wel. Then add ay at the last
b. Write a program in Qbasic to display the following pattern
1
21
321
4321
54321
Answers
Answered by
3
Solution:
1. Using 2 loops, the code goes like -
CLS
FOR I = 1 TO 5
FOR J = I TO 1 STEP -1
PRINT J;
NEXT J
NEXT I
END
2. Using 1 loop, the code goes like -
CLS
LET A = 1
LET B = 2
FOR I = 1 TO 5
PRINT A
A = A + ((I + 1) * 10 ^ I)
NEXT I
END
See the attachments for output.
•••♪
Attachments:
Answered by
3
Answer:
CLS
FOR I=1 TO 5
FOR J= I TO 1 STEP -1
PRINT J
NEXT J
NEXT I
END
Similar questions