136.
Write a function program
to enter
a string and then find out the sum of even ASCII value of each characters.
DECLARE FUNCTION SUM(A$)
CLS
INPUT "ENTER ANY
STRING"; A$
PRINT " SUM OF EVEN
ASCII VALUE="; SUM(A$)
END
FUNCTION SUM (A$)
FOR I = 1 TO LEN(A$)
B$ = MID$(A$, I, 1)
C = ASC(B$)
IF C MOD 2 = 0 THEN S = S + C
NEXT I
SUM=S
No comments:
Post a Comment