Wednesday, October 16, 2019

105. Qbasic program to display 0,1, 3, 6, 10, 15 up to 20th terms.

105. Write a program to display 0,1, 3, 6, 10, 15 up to 20th terms.
DECLARE SUB DISP( )
CLS
CALL DISP
END
SUB DISP ( )
A = 0
B = 1
FOR I = 1 TO 20
    PRINT A
    A = A + B
    B = B + 1
NEXT I
END SUB

No comments:

Post a Comment