Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Python :Sum of digits eg#3
SUBMITTED BY:
Guest
DATE:
Dec. 16, 2013, 8:43 a.m.
FORMAT:
Python
SIZE:
163 Bytes
Raw
Download
Tweet
HITS:
900
Go to comments
Report
# find sum of digits
n
=
input
(
"enter an integer : "
)
total
=
0
for
i
in
n
:
# string is iterable
# print(i)
total
+=
int
(
i
)
print
(
total
)
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus