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
def con_num(inte):
inte = str(inte)
j = 0
for i in inte:
j = j + int(i)
return j
con_num(545)
14
Comments
Leave a comment