Wednesday, October 16, 2019

95. Qbasic Program to generate 22,11,34,17,52,26,13,40,20,10

95. Write a sub procedure to generate  22,11,34,17,52,26,13,40,20,10
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END

SUB SERIES
A = 22
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

No comments:

Post a Comment