Wednesday, October 16, 2019

94. Qbasic Program to generate 7,22,11,34……………10th terms.

94. Write a sub procedure to generate  7,22,11,34……………10th terms.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END

SUB SERIES
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 SUB

3 comments: