Dsa
Math
Easy
Digital Root Calculation
Write a program that computes the digital root of a non-negative integer. The digital root is the single digit value obtained by an iterative process of summing digits until a single digit is obtained. Read a single integer `n` (0 <= n <= 1000).
Input format:
Single integer `n`.
Output format:
Single integer, the digital root of `n`.
Example:
Input:
493
Output:
7
Key concepts
mathdigits
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now