Wednesday, October 2, 2019

12) SUM OF DIGITS (SUB)

DECLARE SUB SUM( N)
CLS 
INPUT " ENTER ANY DIGIT"; 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 DIGIT ="; S
END SUB

No comments:

Post a Comment

My Journey with JM

MY JOURNEY WITH JAGAT MANDIR It has been almost 10 years since I have entered this school. It seems like just yesterday but now I...