Sign in with
Sign up | Sign in
Your question
Closed

C programming solver

Last response: in Windows 7
Share
September 24, 2012 12:44:06 PM

Hello,
please solve this very very immediately.


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.

More about : programming solver

Best solution

September 24, 2012 1:09:46 PM
Share

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
a b $ Windows 7
September 24, 2012 1:15:10 PM

This even looks like a copied and pasted assignment!
Related resources
a c 372 $ Windows 7
September 24, 2012 1:22:42 PM

This topic has been closed by Area51reopened
a c 372 $ Windows 7
September 24, 2012 1:22:59 PM

Best answer selected by Area51reopened.
!