Var ar,ar2:array[1..10] of integer; i:integer; begin randomize; writeln('First array:'); for i:=1 to 10 do begin; ar[i]:=random(10)-3; write(ar[i]:4); if ar[i]=0 then ar2[i]:=0; end; writeln; writeln('1-st Final array:'); for i:=1 to 10 do begin; write(ar2[i]:4); if ar[i]<0 then ar2[i]:=ar[i]; end; writeln; writeln('2-st Final array:'); for i:=1 to 10 do begin; write(ar2[i]:4); if ar[i]>0 then ar2[i]:=ar[i]; end; writeln; writeln('3-st Final array:'); for i:=1 to 10 do write(ar2[i]:4); end.
Var matrix1:array [,] of real; n:integer; tmp:real; begin write('Введи размерность матрицы:'); readln(n); matrix1:=new real[n,n]; for var i:=0 to n-1 do begin for var j:=0 to n-1 do begin matrix1[i,j]:=Random(100); write(matrix1[i,j]:4); end; writeln; end; writeln('Поменяли:'); for var j:=0 to n-1 do begin tmp:=matrix1[j,n-1]; matrix1[j,n-1]:=matrix1[n-1,j]; matrix1[n-1,j]:=tmp; end; for var i:=0 to n-1 do begin for var j:=0 to n-1 do write(matrix1[i,j]:4); writeln; end; end.
ar,ar2:array[1..10] of integer;
i:integer;
begin
randomize;
writeln('First array:');
for i:=1 to 10 do
begin;
ar[i]:=random(10)-3;
write(ar[i]:4);
if ar[i]=0 then ar2[i]:=0;
end;
writeln;
writeln('1-st Final array:');
for i:=1 to 10 do
begin;
write(ar2[i]:4);
if ar[i]<0 then ar2[i]:=ar[i];
end;
writeln;
writeln('2-st Final array:');
for i:=1 to 10 do
begin;
write(ar2[i]:4);
if ar[i]>0 then ar2[i]:=ar[i];
end;
writeln;
writeln('3-st Final array:');
for i:=1 to 10 do
write(ar2[i]:4);
end.
begin
write('Введи размерность матрицы:');
readln(n);
matrix1:=new real[n,n];
for var i:=0 to n-1 do begin
for var j:=0 to n-1 do
begin
matrix1[i,j]:=Random(100);
write(matrix1[i,j]:4);
end;
writeln;
end;
writeln('Поменяли:');
for var j:=0 to n-1 do
begin
tmp:=matrix1[j,n-1];
matrix1[j,n-1]:=matrix1[n-1,j];
matrix1[n-1,j]:=tmp;
end;
for var i:=0 to n-1 do begin
for var j:=0 to n-1 do
write(matrix1[i,j]:4);
writeln;
end;
end.