const N = 10; var c: array[1..N] of integer; a, b, i: integer; begin writeln('Введите отрезок: '); readln(a, b); for i := 1 to N do begin c[i] := random(30); write(c[i],' '); end; writeln;writeln; for i := a to b do begin if(c[i] mod 4 = 0) then write(c[i], ' '); end; end.
Answers & Comments
const
N = 10;
var
c: array[1..N] of integer;
a, b, i: integer;
begin
writeln('Введите отрезок: '); readln(a, b);
for i := 1 to N do begin
c[i] := random(30);
write(c[i],' ');
end;
writeln;writeln;
for i := a to b do begin
if(c[i] mod 4 = 0) then write(c[i], ' ');
end;
end.
var
a, b:integer;
begin
write('a = '); readln(a);
write('b = '); readln(b);
writeln('Чиcла кратные 4 на отрезке от ', a, ' до ', b);
for a := a to b do
if (a mod 4 = 0) and (a <> 0) then
write(a, ' ');
writeln;
end.