0
WHILE LOOP CHANGED question: How do I change the code to calculate and output the sum of all digits of the input number.
n = int(input()) length = 0 while n > 0: n //= 10 length += 1 print(length)
3 Respostas
+ 2
n=int(input())
sum_=0
while n!=0:
sum_+=n%10
n=n//10
print(sum_)
#input : 123
#output : 6
0
n=10
print((n+1)*n//2)
#print(sum(range(n+1)))
0
Idk why but this one whooped on me lol