Wednesday, October 16, 2019

93. Qbasic Program to generate 9,28,14,7,22,11…………..10th term

93. Write a sub program to generate 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

No comments:

Post a Comment