Summing digits of an integer

Write a program that displays the sum of the digits of any non-negative integer.

Two program runs are shown below:
Enter an integer: 145
Sum of digits is 10

Enter an integer: 8888
Sum of digits is 32


Thats how the output should look like its an easy question i think it has to do with int counter+1 or something im not really sure
Ok? Do you want us to do the problem for you?
yes please.
I thought so...
its a school assignment for computer programming 11 I just want to complete it fast.
closed account (o3hC5Di1)
Hi there,

Sorry, we don't do homework for people, as stated in this forums rules.

What we will do is help you to get the program running, but only by helping you along the way - you will have to do the thinking.

So, as you presumably have been taking classes, come up with a program for this and come back to us with your code if you don't know how to continue or if you don't understand something.


All the best,
NwN
Last edited on
Topic archived. No new replies allowed.