Menu Close

Sum of the Input.

Write a program to find the sum of the entered numbers

Refer sample input and output for formatting specification

string=input('Enter any number: ')
sum1=0
for i in range(len(string)):
  sum1+=int(string[i])
print('The total sum of digits is: {}'.format(sum1))

Input_1:
Enter any number: 10
Output:
1


Input_2:
Enter any number: 11
Output:
2


Input_3:
Enter any number: 99
Output:
18


Morae Q!