QBASIC TO FIND SUM OF EVEN NUMBERS BETWEEN 2 TO 50
CLS
FOR I = 2 TO 50 STEP 2
S = S + I
NEXT I
PRINT “SUM OF EVEN NUMBERS BETWEEN 2 TO 50” ; S
END
USING SUB
DECLARE SUB SUM()
CLS
CALL SUM
END
SUB SUM
FOR I = 2 TO 50 STEP 2
S = S + I
NEXT I
PRINT “SUM OF EVEN NUMBERS BETWEEN 2 TO 50” ; S
END SUB
0 Comments