CJCoding With Joseph
15free / daySign inCreate account

Digit Sum

Read a positive whole number and add up its digits with a while loop: the remainder operator % with 10 peels off the last digit and integer division // by 10 removes it; keep going while the number is above 0. Print Digit sum: <total>. Input: one integer, no prompt.

Expected Output:

Digit sum: 10

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
Loops
📥 Auto-Input:
1234\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.