//Pascal ABC.NET v3.0 сборка 1111
Const
n=5;
Var
ma:array[1..n,1..n] of integer;
i,j:integer;
begin
writeln('Matrix reading...');
for i:=1 to n do
begin
writeln;
for j:=1 to n do
readln(ma[i,j]);
end;
writeln('First matrix:');
for i:=1 to n do
begin
writeln;
for j:=1 to n do
begin
write(ma[i,j]:4);
if (ma[i,j]<-8) or (ma[i,j]>6) then ma[i,j]:=sqr(ma[i,j]);
end;
end;
writeln;
writeln('Final matrix:');
for i:=1 to n do
begin
writeln;
for j:=1 to n do
write(ma[i,j]:4);
end;
end.
Пример ввода:
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
Пример вывода:
First matrix:
1 2 3 4 5
6 7 8 9 1
2 3 4 5 6
7 8 9 1 2
3 4 5 6 7
Final matrix:
1 2 3 4 5
6 49 64 81 1
2 3 4 5 6
49 64 81 1 2
3 4 5 6 49