MORE PROGRAM RELATED TO NUMERIC PATTERN USING SUB PROCEDURE (CLICK HERE)
Series
WAP to display the series 2 3 5 8 12 17………. upto 10th terms
CLS
i = 2
FOR j = 1 TO 10
PRINT i;
i = i + j
NEXT j
END
Fibonacci Series
1 1 2 3 5 8……………………10th term
CLS
A = 1
B = 1
PRINT A; B;
FOR i = 1 TO 10
C = A + B
PRINT C;
A = B
B = C
NEXT
END
Hail stone series 7 22 11 34 17 52 26 13 40 20
CLS
a = 7
FOR i = 1 TO 10
PRINT a;
IF a MOD 2 = 0 THEN
a = a / 2
ELSE
a = a * 3 + 1
END IF
NEXT i
END
WAP to display the series 2, 22, 222, 2222, 22222
CLS
i = 2
FOR j = 1 TO 5
PRINT i;
i = i * 10 + 2
NEXT j
END
WAP to display the series 3 12 27 48 ……… upto 10th terms.
CLS
i = 3
FOR j = 1 TO 10
PRINT i * j ^ 2;
NEXT j
END
WAP to display the series 98 97 95 92 88 …….. upto 10th terms
CLS
i = 98
FOR j = 1 TO 10
PRINT i;
i = i – j
NEXT j
END
WAP to display the series 33333 3333 333 33 3
CLS
i = 33333
FOR j = 1 TO 5
PRINT i;
i = INT(i / 10)
NEXT j
END
WAP to display 1 5 9 13 up to 10th term
CLS
FOR i = 0 TO 10
PRINT 4 * i + 1;
NEXT i
END
Numeric Patterns
1
11
111
1111
11111
CLS
a = 1
FOR i = 1 TO 5
PRINT a
a=a * 10 + 1
NEXT
END
Display
1
12
123
1234
12345
CLS
FOR i = 1 TO 5
FOR j = 1 TO i
PRINT j;
NEXT j
NEXT i
END
Display
12345
1234
123
12
1
CLS
FOR i = 5 TO 1 STEP -1
FOR j = 1 TO i
PRINT j;
NEXT j
NEXT i
END
Display
1
22
333
4444
55555
CLS
FOR i = 1 TO 5
FOR j = 1 TO i
PRINT i;
NEXT j
NEXT i
END
Display
55555
4444
333
22
1
CLS
FOR i = 5 TO 1 STEP -1
FOR j = 1 TO i
PRINT i;
NEXT j
NEXT i
END
54321
5432
543
54
5
CLS
FOR i = 1 TO 5
FOR j = 5 TO i STEP -1
PRINT j;
NEXT
PRINT
NEXT
END
54321
4321
321
21
1
CLS
FOR i = 5 TO 1 STEP -1
FOR j = i TO 1 STEP -1
PRINT j;
NEXT j
PRINT
NEXT i
END
13579
1357
135
13
1
CLS
FOR i = 9 TO 1 STEP -2
FOR j = 1 TO i STEP 2
PRINT j;
NEXT j
PRINT
NEXT i
END
10101
1010
101
10
1
CLS
FOR i = 1 TO 5
FOR j = 5 TO i STEP -1
x = j MOD 2
PRINT x;
NEXT
PRINT
NEXT
END
.1
.03
.005
.007
.009
CLS
i = 10
FOR j = 1 TO 9 STEP 2
PRINT j / i
i = i * 10
NEXT
END
5
45
345
2345
12345
CLS
FOR i = 5 TO 1 STEP -1
FOR j = i TO 5
PRINT j;
NEXT j
PRINT
NEXT i
END
5
44
333
2222
11111
CLS
FOR i = 5 TO 1 STEP -1
FOR j = i TO 5
PRINT i;
NEXT j
PRINT
NEXT i
END
55555
4444
333
22
1
CLS
FOR i = 5 TO 1 STEP -1
FOR j = 1 TO i
PRINT i;
NEXT j
PRINT
NEXT i
END
11111
2222
333
44
5
CLS
FOR I = 1 TO 5
FOR J = I TO 5
PRINT I;
NEXT J
PRINT
NEXT I
END
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
1
21
321
4321
54321
CLS
FOR I = 1 TO 5
FOR J = I TO 1 STEP -1
PRINT J;
NEXT J
PRINT
NEXT I
END
1
121
12321
1234321
123454321
CLS
N# = 1
FOR I = 1 TO 5
PRINT N# * N#
N# = (N# * 10) + 1
NEXT I
END
123454321
1234321
12321
121
1
DEFDBL A
a = 11111
WHILE a <> 0
PRINT a * a
a = a \ 10
WEND
END
123454321
1234321
12321
121
1
CLS
n# = 11111
s = 10
FOR i = 1 TO 5
PRINT SPACE$(s); n# * n#
n# = n# \ 10
s = s + 1
NEXT i
END
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
CLS
c = 1
FOR i = 1 TO 5
FOR j = 1 TO i
PRINT c;
c = c + 1
NEXT j
PRINT
NEXT i
END