WAP to print the pattern : 1,12,123,1234,12345

Qbasic program to print the pattern : 1,12,123,1234,12345


1 12 123 1234 12345


CLS
 FOR I = 1 TO 5
 FOR J = 1 TO I
 PRINT J;
 NEXT J
 PRINT
 NEXT I
 END

USING SUB


DECLARE SUB PATTERN()
 CLS
 CALL PATTERN
 END
 
 SUB PATTERN
 FOR I = 1 TO 5
 FOR J = 1 TO I
 PRINT J;
 NEXT J
 PRINT
 NEXT I
 END SUB

Post a Comment

0 Comments