Given an
Integer, add all the digits and check whether it has become a single
digit or not. If it does, display the single digit you got or repeat adding digits until it becomes a single digit and display the single
digit.
For Example:
If the Integer given is 167 = 1 + 6 + 7 = 14 = 1 + 4 = 5 ( it has became a single digit) . Hence, stop adding the digits and the output is "5"
Implementation:
For Example:
If the Integer given is 167 = 1 + 6 + 7 = 14 = 1 + 4 = 5 ( it has became a single digit) . Hence, stop adding the digits and the output is "5"
Implementation: