The sum of digits

Report a typo

Given a three-digit integer (i.e., an integer from 100 to 999), find the sum of its digits and print the result.

For example, your program gets 476 an input. Then your program should sum 4, 7, and 6, and print the result.

To get the separate digits of the input integer, make use of % and // (for example, you can get 8 from the number 508 by taking the remainder of the division by 10).

Sample Input 1:

476

Sample Output 1:

17
Write a program in Python 3
# put your python code here
___

Create a free account to access the full topic