โ Back to Loops
Question 341
Sum of a Number's Digits
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 of123add up to6. For input123the output is: 6
Expected Output:
6
Topics:
Loops
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.