Sum of Digits Problem
Sum of Digits Problem — ExecCode School DSA Practice
Solve the Sum of Digits problem on ExecCode. Free online school DSA practice in Numbers & Math Logic. Write and run code in Java, C++, Python — no signup required to run.
Problem description
You are given one whole number. Your task is to solve Sum of Digits. Look at each digit in that number, add those digits together, and print the sum.
Examples
Input 123; Output 6. Input 4567; Output 22
Constraints
1 <= N <= 10^9
Practice Sum of Digits free on ExecCode. Browse DSA problems, topic map, and placement guides.