WAP to generate pattern 2,22,222........13th term

Qbasic program to generate pattern 2,22,222........13th term


2 22 222 2222 22222 222222 2222222 22222222 222222222 2222222222 22222222222 222222222222 2222222222222


CLS
 A# = 2
 FOR I = 1 TO 13
 PRINT A#;
 A# = A# * 10 + 2
 NEXT I
 END

USING SUB


DECLARE SUB PATTERN()
 CLS
 CALL PATTERN
 END
 
 SUB PATTERN
 A# = 2
 FOR I = 1 TO 13
 PRINT A#;
 A# = A# * 10 + 2
 NEXT I
 END SUB

Post a Comment

0 Comments