Информатика, вопрос задал jjfgfhkkhtugf , 1 год назад

Решите плиз завдання по пайтон

1. Вивести на екран в стовпчик всі числа від 6 до 15 в зворотному порядку.
2. Знайти кількість всіх елементів виду (7n-4), якщо n змінюється від a до b.
3. Обчислити суму всіх елементів кратних 11 на проміжку від 33 до b.

Ответы на вопрос

Ответил kigore17
0

Ответ:

Объяснение:

# Task 1: Display in a column of all numbers from 6 to 15 in reverse order

for i in range(15, 5, -1):

   print(i)

# Task 2: Find the number of all elements of the form (7n-4) if n changes from a to b

a = int(input("Enter the lower bound of the range: "))

b = int(input("Enter the upper bound of the range: "))

count = 0

for i in range(a, b + 1):

   if (7 * i - 4) % 7 == 0:

       count += 1

print("The number of elements is: ", count)

# Task 3: Calculate the sum of all elements that are multiples of 11 between 33 and b

b = int(input("Enter the upper bound of the range: "))

sum = 0

for i in range(33, b + 1):

   if i % 11 == 0:

       sum += i

print("The sum of elements is: ", sum)

Новые вопросы