Patterns in QBASIC (SET-1)
Rajkumar Lama
February 06, 2019
learn qbasic
,
patterns in qbasic
,
print patterns qbasic
,
qbasic code
,
qbasic for class 10
,
QBASIC Pattern printing
,
qbasic pattern types
1) | 5 54 543 5432 54321 | CLS FOR i = 5 TO 1 STEP -1 FOR j = 5 TO i STEP -1 PRINT j; NEXT j PRINT NEXT i END |
2) | 54321 5432 543 54 5 | CLS FOR i = 1 TO 5 STEP 1 FOR j = 5 TO i STEP -1 PRINT j; NEXT j PRINT NEXT i END |
3) | 1 12 123 1234 12345 | CLS FOR i = 1 TO 5 FOR j = 1 TO i PRINT j; NEXT j PRINT NEXT i END |
4) | 12345 1234 123 12 1 | CLS FOR i = 5 TO 1 STEP -1 FOR j = 1 TO i STEP 1 PRINT j; NEXT j PRINT NEXT i END |
5) | 1 22 333 4444 55555 | CLS FOR i = 1 TO 5 FOR j = 1 TO i PRINT i; NEXT j PRINT NEXT i END |
6) | 55555 4444 333 22 1 | CLS FOR i = 5 TO 1 STEP -1 FOR j = 1 TO i STEP 1 PRINT i; NEXT j PRINT NEXT i END |
7) | * *** ***** ******* ********* | CLS s$ = "*********" t = 10 FOR i = 1 TO LEN(s$) STEP 2 PRINT TAB(t); LEFT$(s$, i) t = t - 1 NEXT i END |
8) | 2 22 222 2222 22222 | CLS n = 2 FOR i = 1 TO 5 PRINT n n = n * 10 + 2 NEXT i END |
9) | 1 11 111 1111 11111 | CLS n = 1 FOR i = 1 TO 5 PRINT n n = n * 10 + 1 NEXT i END |
10) | 11111 1111 111 11 1 |
CLS n = 11111 FOR i = 1 TO 5 PRINT n n = n \ 10 NEXT i END |
11) |
R ER TER UTER PUTER MPUTER OMPUTER COMPUTER |
CLS X$ = "COMPUTER" FOR i = 1 TO LEN(X$) PRINT RIGHT$(X$, i) NEXT i END |
12) | C CO COM COMP COMPU COMPUT COMPUTE COMPUTER |
CLS X$ = "COMPUTER" FOR i = 1 TO LEN(X$) PRINT LEFT$(X$, i) NEXT i END |
13) | * ** *** **** ***** |
CLS a$ = "*****" FOR i = 1 TO LEN(a$) PRINT LEFT$(a$, i) NEXT i END |
14) |
***** **** *** ** * |
CLS a$ = "*****" FOR i = LEN(a$) TO 1 STEP -1 PRINT LEFT$(a$, i) NEXT i END |
15) | ********* ******* ***** *** * |
CLS a$ = "*********" FOR i = LEN(a$) TO 1 STEP -2 PRINT LEFT$(a$, i) NEXT i END |
16) | ********* ******* ***** *** * |
CLS x$ = "*********" b = 1 t = 20 FOR i = LEN(x$) TO 1 STEP -2 PRINT TAB(t); MID$(x$, b, i) b = b + 1 t = t + 1 NEXT i END |
Need more patterns ? click here ... (Patterns in QBASIC SET-2)