var a: array[1..MAX_SIZE] of integer; i, size: integer;
procedure delete_odd_elements(); var i, j: integer; begin i := 1; repeat if odd(a[i]) then begin dec(size); for j := i to size do a[j] := a[j + 1] end else inc(i); until i > size; end;
begin writeln('Исходный массив: '); size := MAX_SIZE; for i := 1 to size do begin a[i] := random(100); write(a[i] : 3); end; delete_odd_elements; writeln; writeln('Полученный массив: '); for i := 1 to size do write(a[i] : 3); end.
Если нужен паскаль:
1.
var
a,b:integer;
begin
readln(a,b);
writeln(a,'+',b,'=',a+b);
writeln(a,'*',b,'=',a*b);
end.
2.
var
n,c,m,h:integer;
begin
readln(n);
m:=n div 60;
c:=n mod 60;
if m>=60 then
begin
h:=m div 60;
m:=m mod 60;
if m<>0 then
if c<>0 then
write(h,'ч ',m,'мин ',c,'с')
else
write(h,'ч ',m,'мин ')
else
if c<>0 then
write(h,'ч ',c,'с')
else
write(h,'ч');
end
else
if m<>0 then
if c<>0 then
write(m,'мин ',c,'с')
else
write(m,'мин ')
else
write(c,'с');
end.
MAX_SIZE = 10;
var
a: array[1..MAX_SIZE] of integer;
i, size: integer;
procedure delete_odd_elements();
var i, j: integer;
begin
i := 1;
repeat
if odd(a[i]) then
begin
dec(size);
for j := i to size do
a[j] := a[j + 1]
end
else inc(i);
until i > size;
end;
begin
writeln('Исходный массив: ');
size := MAX_SIZE;
for i := 1 to size do
begin
a[i] := random(100);
write(a[i] : 3);
end;
delete_odd_elements;
writeln;
writeln('Полученный массив: ');
for i := 1 to size do
write(a[i] : 3);
end.