
ПОЖАЛУЙСТА ПОМОГИТЕ 1. Написать программу, которая выводит на экран в одной строке через пробел
числа от 15 до 72 с шагом 3(15 18 21 ...), используя цикл while.

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

Ответ:
a=15
while a<=72:
print(a,end=' ')
a+=3
Объяснение:
отступы на скрине




Program to Print Numbers Using a While Loop in C++
Here's a program that uses a `while` loop to print numbers from 15 to 72 with a step of 3, all in one line separated by spaces:
```cpp
#include
int main() { int num = 15; while (num <= 72) { std::cout << num << " "; num += 3; } return 0; } ```
This program initializes the variable `num` to 15. It then enters a `while` loop that continues as long as `num` is less than or equal to 72. Inside the loop, it prints the value of `num` followed by a space using `std::cout`. After printing, it increments `num` by 3. The loop continues until `num` is no longer less than or equal to 72.
When you run this program, it will output the numbers from 15 to 72 with a step of 3, all in one line separated by spaces.
Note: The program assumes you are using C++ and have the necessary libraries included. Make sure to include the appropriate headers (`iostream` in this case) and use the correct namespace (`std`) for input/output operations.
I hope this helps! Let me know if you have any further questions.


Похожие вопросы







Топ вопросов за вчера в категории Информатика







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