
напишите программу в Python (с помощью while,if,else). С помощью цикла вывести все числа кратные 3
от -30 до 30 включительно. ДАЮ 20 БАЛЛОВ

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

x = -30
y = 30
while x <= y:
x += 1
print(x)
Объяснение:



Python Program to Print Multiples of 3
Here's a Python program that uses a while loop, if-else statements to print all numbers that are multiples of 3 from -30 to 30 (inclusive):
```python num = -30 while num <= 30: if num % 3 == 0: print(num) num += 1 ```
This program initializes a variable `num` with -30 and then uses a while loop to iterate through the numbers from -30 to 30. Inside the loop, it uses an if statement to check if the current number is a multiple of 3. If it is, the number is printed. Finally, the `num` is incremented by 1 in each iteration.
This program effectively prints all the numbers that are multiples of 3 within the specified range.
I hope this helps! If you have any further questions or need additional assistance, feel free to ask.


Похожие вопросы
Топ вопросов за вчера в категории Другие предметы
Последние заданные вопросы в категории Другие предметы
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili