CJCoding With Joseph

Sum of a Number's Digits

Read a positive integer from input and use a loop to add up its digits, then print the sum. For example, the digits of 123 add up to 6.

For input 123 the output is:

6

Expected Output:

6
Topics:
Loops
๐Ÿ“ฅ Auto-Input:
123\n
This input is automatically fed to your program's stdin
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.