To Find The Sum From 1 to N (Qbasic Code)

- CLS

INPUT "Enter the number upto which you want to add"; n

s = 0

FOR i = 1 TO n

s = s + i

NEXT i

PRINT "The sum is "; s

END

**Next Method (Using DO WHILE ... LOOP)**- CLS

INPUT "Enter the number upto which you want to add"; n

s = 0

c = 1

DO WHILE c <= n

s = s + c

c = c + 1

LOOP

PRINT "The sum is "; s

END