Answer to Question #310668 in Python for Venu

Question #310668

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




Input:




The input is single line containing a positive integer N




Output :




The output should be a single-line containing a single - numeral number





Sample input :




545




Sample output :




5

1
Expert's answer
2022-03-13T01:33:33-0500
def con_num(inte):
    inte = str(inte)
    j = 0
    for i in inte:
        j = j + int(i)
    return j
con_num(545)
14

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