Digital Root
Computer Mathematics
Medium
2 views
Problem Description
Given a non-negative integer n (as string), print its digital root (0-9).
Input Format
One line: digits string s.
Official Solution
If number is 0 output 0. Else compute modulo 9; if mod==0 output 9 else mod.
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!