Wednesday, October 13, 2021

QBASIC Program to Print the series 7, 22, 11, 34, 17, 52, 26, 13, 40, 20 (SUB/FUNCTION Procedure)

CLS
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


Series Using SUB Procedure

DECLARE SUB series()
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


Series Using FUNCTION Procedure

DECLARE FUNCTION series()
s = series
END

FUNCTION 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 FUNCTION

No comments:

Post a Comment

If you have any doubts, Please let me know.

[Download PDF] Computer Science Book Gread-10 in Nepali Language

 If you are searching for class 10 Computer Science in Nepali pdf for free download then you are at the right page. This book is soley publi...