Day dreamer
Saturday, November 2, 2019
#12 SUM OF DIGITS
DECLARE SUB SUM (N)
CLS
INPUT"ENTER ANY NUMBER";N
CALL SUM (N)
END
SUB SUM (N)
S=0
WHILE N <>0
R= N MOD 10
S= S + R
N = N / 10
WEND
PRINT "SUM OF DIGITS";S
END FUNCTION
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment