# Doubt in Codekata basics problem

42
Views

1
Comments

GokilaE
2 weeks ago

**Write a code get an integer number as input and print the sum of the digits.**

**Input Description:**

A single line containing an integer.

**Output Description:**

Print the sum of the digits of the integer.

Sample Input :

124

Sample Output :

7

```
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.