FIBONACCI AND OTHER SERIES
181. WAP to generate the following numeric pattern 1,12,123,1234,12345
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
FOR I = 1 TO 5
FOR J = 1 TO I
PRINT J;
NEXT J
PRINT
NEXT I
END SUB
182. WAP to generate the following series 55555,4444,333,22,1
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
FOR I = 5 TO 1 STEP -1
FOR J = 1 TO I
PRINT I;
NEXT J
PRINT
NEXT I
END SUB
183. WAP to generate the following series 5,54,543,5432,54321
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
FOR I = 5 TO 1 STEP -1
FOR J = 5 TO I STEP -1
PRINT J;
NEXT J
PRINT
NEXT I
END SUB
184. WAP to generate the following series 54321,5432,543,54,5
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
FOR I = 5 TO 1 STEP -1
FOR J = I TO 1 STEP -1
PRINT J;
NEXT J
PRINT
NEXT I
END SUB
185. WAP to generate the following series 1,10,101,1010,10101
186. WAP to generate the following series 88888888,666666,4444,22
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
FOR I = 8 TO 2 STEP -2
FOR J = 1 TO I
PRINT I;
NEXT J
PRINT
NEXT I
END SUB
187. WAP to generate the following series 13579,1357,135,13,1
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
FOR I = 9 TO 1 STEP -2
FOR J = 1 TO I STEP 2
PRINT J;
NEXT J
PRINT
NEXT I
END SUB
188. WAP to generate the following series 1,23,456,78910
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
N = 1
FOR I = 1 TO 4
FOR J = 1 TO I
PRINT N;
N = N + 1
NEXT J
PRINT
NEXT I
END SUB
189. WAP to generate the following series 123456789,1234567,12345,123,1
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
A# = 123456789
FOR I = 1 TO 5
PRINT A#
A# = A# \ 100
NEXT I
END SUB
190. WAP to generate the following series ½, 2/3, ¾……….15th term.
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
A = 1
B = 2
FOR I = 1 TO 15
PRINT A; "/"; B
A = A + 1
B = B + 1
NEXT I
END SUB
191. WAP to generate the following series 2,4,6,8………….12th term.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
A = 2
FOR I = 1 TO 12
PRINT A,
A = A + 2
NEXT I
END SUB
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
A = 2
B = 3
FOR I = 1 TO 10
PRINT A;
C = A + B
A = B
B = C
NEXT I
END SUB
193. WAP to generate the following series 11,3,14,17,31………….18th term.
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
A = 11
B = 3
FOR I = 1 TO 18
PRINT A;
C = A + B
A = B
B = C
NEXT I
END SUB
194. WAP to generate the following series 1,4,9…………..9th term.
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
FOR I = 1 TO 9
PRINT I ^ 2
NEXT I
END SUB
195. WAP to generate the following series 9,28,14,7,22,11…………..10th term
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
A = 9
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 SUB
196. WAP to generate the series 1,4,7,10………….12th terms.
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
A = 1
FOR I = 1 TO 12
PRINT A;
A = A + 3
NEXT I
END SUB
197. WAP to generate the series 10,20,30………100.
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
A = 1
FOR I = 10 TO 100 STEP 10
PRINT I,
NEXT I
END SUB
198. WAP to generate the series 100,95,90…………………..10th term.
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
A = 100
FOR I = 1 TO 10
PRINT A;
A = A - 5
NEXT I
END SUB
199. WAP to generate the series 1,8,27……………8th.
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
FOR I = 1 TO 8
PRINT I ^ 3,
NEXT I
END SUB
200. WAP to generate the series 2,22,222………..13th term.
DECLARE SUB SERIES ()
CLS
CALL SERIES
END
SUB SERIES
A# = 2
FOR I = 1 TO 13
PRINT A#;
A# = A# * 10 + 2
NEXT I
END SUB
Comments