Question #289174

Ram is given a positive integer N .He wishes to convert this integer into a single numeral. He does so by repeatedly adding the numerals of the number until there is only a single numeral. Help Ram by providing the single-numeral number finally obtained.


Expert's answer

def digSum(n):


    if (n == 0):
        return 0
    if (n % 9 == 0):
        return 9 
    else:
        return (n % 9)
digSum(5463)
9

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS