Answer to Question #289174 in Python for Rishu Pandey

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.


1
Expert's answer
2022-01-21T08:39:02-0500
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS