program arrays uses crt var arr1 arr2 array of integer max1 max2 max1_

 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
46
47
48
49
50
51
52
53
54
55
56
57
program arrays;
uses crt;
var
arr1, arr2: array [0..9] of integer;
i, max1, max2, max1_key, max2_key: integer;
begin
for i:=0 to 9 do begin
arr1 [i] := random (255-0+1)+0;
if arr1 [i] > max1 then begin
max1 := arr1[i];
max1_key := i;
end;
arr2 [i] := random (255-0+1)+0;
if arr2 [i] > max2 then begin
max2 := arr2[i];
max2_key := i;
end;
end;
writeln ('Исходные массивы:');
for i:=0 to 9 do begin
write (arr1 [i], ',');
end;
writeln ();
for i:=0 to 9 do begin
write (arr2 [i], ',');
end;
writeln ();
writeln('Максимальные эллементы:');
writeln ('В массиве А: ', max1);
writeln ('В массиве B: ', max2);
arr1 [max1_key] := max2;
arr2 [max2_key] := max1;
writeln ('Итоговые массивы:');
for i:=0 to 9 do begin
write (arr1 [i], ',');
end;
writeln ();
for i:=0 to 9 do begin
write (arr2 [i], ',');
end;
end.