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)
Login to submit your solution