0
I don't know where is the mistake...
i=int(input()) while 100000>i>0: i=int(i/10000)+int((i%10000)/1000)+int((i%1000)/100)+int((i%100)/10)+(i%10) if i>9: continue if i<+9: break print(i)
5 odpowiedzi
+ 4
https://code.sololearn.com/cT6KM53oE2h9
i = int(input())
n = 0;
while i > 0:
n += i%10
i //= 10
if i == 0 and n > 9:
i = n
n = 0
print(n)
+ 1
why did you use a while loop?(BTW code you posted is not indented correctly)
what did you meant to do in this program?
+ 1
i=input().strip()
sum=0
while True:
sum=0
for c in list(i):
sum+=int(c)
if sum<10:
break
else :
i=str(sum)
print(sum)
0
I want to find the sum of each digit. If the sum is greater than 9, find the sum of its bits. Until the sum is a single digit. Sorry, my English is not good.
0
Thank you! I got it.