All challenges
easymath 10 XP per passing test

Sum of Digits

Problem

Given a string of digits, calculate the sum of its digits. The input string consists of one or more digits. The first line of the input contains a string of digits. The expected output is a single integer, the sum of the digits in the input string.
(run your code to see output)
Advertisement
Sponsored