project_python/2.3_lesson.4.20.py
2025-12-15 13:50:02 +05:00

16 lines
635 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

****Задание 4 Параграф 2.3***
**** К вам снова пришли за помощью: нужна программа, которая посчитает сумму всех цифр всех чисел, поданных на вход.
Вы справитесь — у вас ведь уже есть всё необходимое: циклы и уверенность в своих силах!****
if name == "main":
count = int(input())
summa = 0
for _ in range(count):
number = int(input())
while number > 0:
summa += number % 10
number //= 10
print(summa)