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 SUM
Subscribe to:
Post Comments (Atom)
-
During my time in high school I had it really good moments, but my best moments that I've experienced are in a particular class during ...
-
DECLARE SUB SERIES ( ) CLS CALL SERIES END SUB SERIES ( ) A = 1 B = 1 FOR I = 1 TO 5 PRINT AA PRINT B A = A +B B = A + B NEXT I...
-
DECLARE SUB Area ( R ) CLS INPUT "Enter radius'; R CALL Area ( R ) END SUB Area ( R ) A = 22 / 7 * R ^ 2 PRINT "Area o...
No comments:
Post a Comment