Sum of digits of a three-digit number
C#
Easy
math
Task «Sum of digits of a three-digit number»
Write a program that takes a three-digit integer and calculates the sum of its digits. The number can be positive or negative. It is guaranteed that the absolute value of the number is a three-digit number (from 100 to 999). The program should output the sum of the digits of this number.
Input Format
One line containing an integer n (|n| from 100 to 999).
Output Format
One integer — the sum of the digits of the number n.
Examples
Example 1
INPUT
123
OUTPUT
6
Example 2
INPUT
999
OUTPUT
27
main.cs