Find the sum of all the digits of a user input positive integer. Remember, the user inputs the number as one input (use one scanf() only). That is to say that the digits are not to be treated separately.

For example, some sample runs are presented here:

Enter a positive integer: 1<enter> 1 = 1

Enter a positive integer: 125<enter> 1 + 2 + 5 = 8

Enter a positive integer: 5646876<enter> 5 + 6 + 4 + 6 + 8 + 7 + 6 = 42

Enter a positive integer: -123<enter> Number not valid! Please enter a positive number.

5
answers
Last replyBest Answer

More aboutprogramming solver

Best answer

ddpruitt

I'm sure this is homework you were assigned.

Something like this isn't to difficult to do, you'll learn far more by learning how to do it yourself

mi1ez

This even looks like a copied and pasted assignment!