Программа:
Python:
Вариант 1)
N = int(input())
sum = 0
while N > 0:
j = N % 10
N //= 10
sum += j
print(sum)
Вариант 2)
print(sum([int(j) for j in input()]))
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
Программа:
Python:
Вариант 1)
N = int(input())
sum = 0
while N > 0:
j = N % 10
N //= 10
sum += j
print(sum)
Вариант 2)
print(sum([int(j) for j in input()]))