CJCoding With Joseph

While Loop: Sum of Digits

Use a while loop to add up the individual digits of the number 1234 and print the sum (1 + 2 + 3 + 4).

Expected output:

10

Expected Output:

10
Topics:
Loops
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (clog, fn, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.