Даны 5 чисел (могут быть и отрицательные и положительные), вывести нечетные числа, которые меньше нуля.
Написать программу Pascal ABC
Ответы
Ответ дал:
0
var a,b,c,d,e:integer;
begin
readln(a,b,c,d,e);
if (a mod 2<>0)and(a<0) then write(a);
if (b mod 2<>0)and(b<0) then write(' ',b);
if (c mod 2<>0)and(c<0) then write(' ',c);
if (d mod 2<>0)and(d<0) then write(' ',d);
if (e mod 2<>0)and(e<0) then write(' ',e);
end.
Пример:
-15 42 -10 27 -79
-15 -79
begin
readln(a,b,c,d,e);
if (a mod 2<>0)and(a<0) then write(a);
if (b mod 2<>0)and(b<0) then write(' ',b);
if (c mod 2<>0)and(c<0) then write(' ',c);
if (d mod 2<>0)and(d<0) then write(' ',d);
if (e mod 2<>0)and(e<0) then write(' ',e);
end.
Пример:
-15 42 -10 27 -79
-15 -79
Ответ дал:
0
После then write(' ',b);
Ответ дал:
0
' ' - пробел
Вас заинтересует
2 года назад
2 года назад
3 года назад
9 лет назад
9 лет назад