Thursday, October 17, 2019

145. Qbasic to Print following pattern * *** ***** *******


145.      Print following pattern

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

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

No comments:

Post a Comment