Sign in $ create-account
~/problems ~/discussion ~/contests ~/submission
← ~/problems
P2000

Sum of Digits

Easy
// Description
Given a non-negative integer n, output the sum of its decimal digits.
// Input
A single line containing one integer n (0 <= n <= 10^18).
// Output
A single integer: the sum of the decimal digits of n.
// Hint
Read the number as a string and add up the characters.
// Samples
Sample Input
12345
Sample Output
15
// Problem Info
DifficultyEasy
Acceptance50%
Time Limit1000 ms
Memory Limit65536 KB
Accepted5