Find the code

Given a number return its code. Code is defined as a single digit number which is obtained by repeatedly adding digits of the number till you reach a single digit.

Example. if given number is 987, then its code will be 6. (9+8+7=24 => 2+4=6)

Sample Input
Sample Output

Login to submit your solution

Fb dab53a1a64929320dc7425896aa73fd9e5512b6ab52e414ff5f3ebb5cecc73eb

Share Problem