Compilation: main.cpp
Sourced: http://rosettacode.org/wiki/Digital_root
Code Author: VikingOfValhalla
Purpose: To calculate the digital root and additive persistence based on user input.
Example Input:
- 627615
- 39390
- 588225
- 393900588225
Example Output:
$ Initial Input: 627615
$ 627615 has an additive persistence of 2 and a digital root of 9
$ Initial Input: 39390
$ 39390 has an additive persistence of 2 and a digital root of 6
$ Initial Input: 588225
$ 588225 has an additive persistence of 2 and a digital root of 3
$ Initial Input: 393900588225
$ 39390058825 has an additive persistence of 2 and a digital root of 9
Constraints:
The digital root may be calculated in bases other than 10