
Вывести в столбик нечетные числа диапазона [-1;18]паскаль оператор for


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

Ответ:
program z;
var i:integer;
begin
for i:=-1 to 18 do
if i mod 2 <> 0 then writeln(i)
end.
Объяснение:
цикл for с границами диапазона + неполный условный оператор if then для вывода нечётных чисел



Написано на языке программирования C++




Pascal Code to Print Odd Numbers in Range [-1;18] using a For Loop
To print the odd numbers in the range [-1;18] in Pascal using a for loop, you can use the following code:
```pascal program PrintOddNumbers; var i: integer; begin for i := -1 to 18 do begin if i mod 2 <> 0 then writeln(i); end; end. ```
This Pascal code initializes a variable `i` of type integer and uses a for loop to iterate through the range from -1 to 18. Within the loop, it checks if the current value of `i` is odd using the condition `i mod 2 <> 0` and prints the value if it is odd.
This code will output the odd numbers in the specified range in a column.
Note: The `mod` operator in Pascal returns the remainder of a division operation.
I hope this helps! If you have any further questions or need additional assistance, feel free to ask.


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







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