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: