Saturday, March 10, 2018

Qbasic Program to generate the series 20, 10, 5, 16.......7th term

Qbasic Program to generate the series 20, 10, 5, 16.......7th term


CLS
a = 20
FOR i = 1 TO 7
    PRINT a
    IF a MOD 2 = 0 THEN
        a = a / 2
    ELSE
        a = a * 3 + 1
    END IF
NEXT i
END

No comments:

Post a Comment