QBASIC PROGRAM TO FIND SUM OF EVEN NUMBERS AMONG 10 USER-INPUT NUMBERS
CLS
DIM N(10)
FOR I = 1 TO 10
INPUT "ENTER THE NUMBERS"; N(I)
IF N(I) MOD 2 = 0 THEN S = S + N(I)
NEXT I
PRINT "SUM OF 10 EVEN NUMBERS"; S
END
USING SUB
DECLARE SUB SUMEVEN()
CLS
CALL SUMEVEN
END
SUB SUMEVEN
DIM N(10)
FOR I = 1 TO 10
INPUT "ENTER THE NUMBERS"; N(I)
IF N(I) MOD 2 = 0 THEN S = S + N(I)
NEXT I
PRINT "SUM OF 10 EVEN NUMBERS"; S
END SUB
0 Comments