Numeric pattern in QBASIC
1)
1 11 111 1111 11111 |
DECLARE SUB series () CLS CALL series END SUB series CLS a=1 FOR x= 1 to 5 PRINT a a=a*10+1 NEXT END SUB |
2)
11111 1111 111 11 1 |
DECLARE SUB ser () CLS CALL ser END SUB ser a = 11111 FOR x = 1 TO 5 PRINT a a = a \ 10 NEXT END SUB |
3)
1 12 123 1234 12345 |
DECLARE SUB ser () CLS CALL ser END SUB ser CLS FOR i = 1 TO 5 FOR j = 1 TO i PRINT j; NEXT j PRINT NEXT i END SUB |
4)
12345 1234 123 12 1 |
DECLARE SUB ser () CLS CALL ser END SUB ser CLS FOR x = 5 TO 1 STEP -1 FOR y = 1 TO x PRINT y; NEXT y PRINT NEXT x END SUB |
5)
54321 5432 543 54 5 |
DECLARE SUB ser () CLS CALL ser END SUB ser CLS |
6)
54321 4321 321 21 1 |
DECLARE SUB ser () CLS CALL ser END SUB ser CLS |
7)
5 45 345 2345 12345 |
DECLARE SUB ser () CLS CALL ser END SUB ser CLS |
8)
1 22 333 4444 55555 |
DECLARE SUB ser () CLS CALL ser END SUB ser CLS FOR p = 1 TO 5 FOR q = 1 TO p PRINT q; NEXT q PRINT NEXT p END SUB |
9)
55555 4444 333 22 1 |
DECLARE SUB ser () CLS CALL ser END SUB ser CLS FOR p = 5 TO 1 STEP -1 FOR q = 1 TO p PRINT p; NEXT q PRINT NEXT p END SUB |
10)
11111 2222 333 44 5 |
DECLARE SUB ser () CLS CALL ser END SUB ser CLS |
11)
1 21 321 4321 54321 |
DECLARE SUB ser () CLS CALL ser END SUB ser CLS |
12)
5 54 543 5432 54321 |
DECLARE SUB ser () CLS CALL ser END SUB ser CLS |
13)
1 33 555 7777 |
DECLARE SUB ser () CLS CALL ser END SUB ser CLS FOR I = 1 TO 7 STEP 2 FOR J = 1 TO I STEP 2 PRINT I; NEXT J PRINT NEXT I END SUB |
14)
10 20
30 40 50 20 30
40 50 60 30 40
50 60 70 40 50
60 70 80 50 60
70 80 90 |
DECLARE SUB ser () CLS CALL ser END SUB ser CLS FOR x= 0 to 4 FOR y=1 to 5 PRINT (x+y)*10; NEXT y PRINT NEXT x END SUB |
15)
1 |
DECLARE SUB series () CLS CALL series END SUB series a# = 1 FOR x = 1 TO 5 PRINT a# ^ 2 a# = a# * 10 + 1 NEXT END SUB |
16)
123454321 1234321 12321 121 1 |
DECLARE SUB series () CLS CALL series END SUB series a# = 11111 FOR x = 1 TO 5 PRINT a# ^ 2 a# = a# \10 NEXT END SUB |
17)
123454321 1234321 12321 121 1 |
DECLARE SUB series () CLS CALL series END SUB series a# = 11111 t=1 FOR x = 1 TO 5 PRINT TAB(t);a# ^ 2 a# = a# \10 t=t+1 NEXT END SUB |
No comments:
Post a Comment