-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMATRICA.PAS
45 lines (45 loc) · 970 Bytes
/
MATRICA.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
program matrix;
uses crt;
const pask = 10;
var m : array [1 .. pask, 1 .. pask] of byte;
x, y, pg : byte;
begin
clrscr;
for x := 1 to pask do
begin
for y := 1 to pask do
begin
m [x, y] := random (100);
if (x = y) or (y = pask - x + 1) then
begin
textcolor (5);
write (m [x, y] :5);
textcolor (7);
end
else write (m [x, y] :5);
end;
writeln;
end;
for x := 1 to pask do
begin
y := x;
pg := m [x, y];
m [x, y] := m [pask - x + 1, y];
m [pask - x + 1, y] := pg
end;
writeln;
writeln;
for x := 1 to pask do
begin
for y := 1 to pask do
if (x = y) or (y = pask - x + 1) then
begin
textcolor (5);
write (m [x, y] :5);
textcolor (7);
end
else write (m [x, y] :5);
writeln
end;
readkey;
end.