Sum of Three Digits

Lab Python Beginner 10 points

Read a three-digit positive integer and print the sum of its digits using only arithmetic (// and %), not strings.

Input

An integer from 100 to 999.

Output

The sum of its digits.

Example

Input

123

Output

6
Sample input available Sample output available
Editor
Python

Hints

n % 10 is the last digit.

n // 10 % 10 is the middle digit, n // 100 the first.

Solution explanation

Dividing by 10 shifts digits right; % 10 picks the last one.

Show solution
n = int(input())
print(n // 100 + n // 10 % 10 + n % 10)
Output
Answer
HOME LEARN COMMUNITY DASHBOARD