Digital Root

Computer Mathematics Medium 2 views
Back to Questions

Problem Description

Given a non-negative integer n (as string), print its digital root (0-9).

Input Format

One line: digits string s.

Output Format

One digit.

Sample Test Case

Input:
9875
Output:
2

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next