Write a code get an integer number as input and print the sum of the digits.
A single line containing an integer.
Print the sum of the digits of the integer.
Sample Input :
Sample Output :
n = int(input()) r = 0 while n>0: d = n%10 r = r+d n = n/10 print(r)
I got an output 7.777777777777778. I don't want float an output i need an exact 7. How to be solved above problem, please anyone can help.