Wednesday, October 16, 2019

122. Qbasic program to enter 10 different numbers then find out sum of even numbers

122. Write a sub program to  enter 10 different numbers then find out sum of even numbers

DECLARE SUB SUM(N())
CLS
FOR I = 1 TO 10
    INPUT "ENTER 10 NUMBERS"; N(I)
NEXT I

CALL SUM(N())
END
SUB SUM (N())
FOR I = 1 TO 10
    IF N(I) MOD 2 = 0 THEN S = S + N(I)
NEXT I
PRINT "SUM OF EVEN NUMBERS="; S
END SUB

No comments:

Post a Comment