Skip to content

Small program to calculate the digital root and additive persistence based on user input.

Notifications You must be signed in to change notification settings

VikingOfValhalla/cpp_digital_root

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Digital Root

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

About

Small program to calculate the digital root and additive persistence based on user input.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published