Sum of digits of a number
PHP
Easy
math
Task «Sum of digits of a number»
Write a program that calculates the sum of digits of a given natural number. The number can be large, so use a string representation. Output the sum of digits.
Input Format
One positive integer N (1 <= N <= 10^1000).
Output Format
One integer — the sum of the digits of the number N.
Examples
Example 1
INPUT
123
OUTPUT
6
Example 2
INPUT
9999
OUTPUT
36
main.php