Network disconnected
Description
Given a natural number N
as the parameter, write a function solution
to return the sum of each digit of N
.
For example, if N = 123, return 1 + 2 + 3 = 6.
Constraints
- Range of
N
: natural number less than or equal to 100,000,000.
Examples
N | answer |
---|---|
123 | 6 |
987 | 24 |
Example #1
Same as the example in the problem statement.
Example #2
Since 9 + 8 + 7 = 24, return 24.
Result
Stop
Result of [Run Test] or [Submit] will be displayed here
내가 제출한 코드가 왜 틀렸는지 프로그래머스 AI에게 물어보세요.
제출 후 채점하기를 눌러 30점 이상인 경우 물어볼 수 있어요.
베타 기간 동안에는 한 문제당 1번만 물어볼 수 있어요.
베타 기간 동안에는 한 문제당 1번만 물어볼 수 있어요.