Python for Engineers
Solve Problems by Coding Solutions - A Complete solution for python programming
Blog Pages
Blog
News
Distributions
NumPy Tutorials
Self Learning
IDE
Packages
About
Sum of digits of the a given number
n=int(raw_input('Enter the number: '))
sum=0
while n>0:
rem=n%10
sum=sum+rem
n=n/10
print 'Sum of digits of the number is: ',sum
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment