QBASIC SERIES : 1,2,4,8.....10TH TERM
CLS
a = 1
FOR i = 1 TO 10
PRINT a
a = a * 2
NEXT i
END
USING SUB
DECLARE SUB SERIES()
CLS
CALL SERIES
END
SUB SERIES
a = 1
FOR i = 1 TO 10
PRINT a
a = a * 2
NEXT i
END SUB
USING FUNCTION
DECLARE FUNCTION SERIES(a)
CLS
a = 1
FOR i = 1 TO 10
PRINT SERIES(a)
NEXT i
FUNCTION SERIES(a)
a=a*2
SERIES = a
END FUNCTION
0 Comments