Fortuneteller

Report a typo

Imagine you are writing a program that will give a prediction for users. Say, you intend to do so based on a number they enter. Write a program that reads a number and prints the sum of its digits. Considering the potential for large input numbers, ensure that the solution is memory-efficient and doesn't store all the digits in memory at once.

An input number and hence the output number are both positive.

Sample Input 1:

5358052

Sample Output 1:

28

Sample Input 2:

4066376

Sample Output 2:

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

Create a free account to access the full topic