Определите количество четных элементов в последовательности, завершающейся числом 0.
Python
# Инициализируем переменную для хранения количества четных элементов
count_even = 0
# Считываем числа последовательности
while True:
number = int(input("Введите число (для завершения введите 0): "))
if number == 0:
break
if number % 2 == 0:
count_even += 1
# Выводим результат
print("Количество четных элементов:", count_even)
Output
Embed on website
To embed this program on your website, copy the following code and paste it into your website's HTML:
Comments
This comment belongs to a banned user and is only visible to admins.
This comment belongs to a deleted user and is only visible to admins.