Thursday, October 17, 2019

143. Qbasic program to print the following pattern: NEPAL EPAL PAL AL L


143.      Write a sub to print the following pattern:
NEPAL
               EPAL
PAL
AL
L

DECLARE SUB PATTERN (S$)
CLS
S$ = "NEPAL"
CALL PATTERN(S$)
END

SUB PATTERN (S$)
FOR I = LEN(S$) TO 1 STEP - 1
PRINT RIGHT$(S$, I)
NEXT I
END SUB

No comments:

Post a Comment