From af17dd6f97de8d08c0aa926aac267b042e1adad8 Mon Sep 17 00:00:00 2001 From: user Date: Tue, 16 Dec 2025 10:18:11 +0500 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5=204?= =?UTF-8?q?=20=D0=BF=D0=B0=D1=80=D0=B0=D0=B3=D1=80=D0=B0=D1=84=202.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2.3_lesson.4.20.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 2.3_lesson.4.20.py diff --git a/2.3_lesson.4.20.py b/2.3_lesson.4.20.py new file mode 100644 index 0000000..113c361 --- /dev/null +++ b/2.3_lesson.4.20.py @@ -0,0 +1,16 @@ +****Задание 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)