Created
June 25, 2017 14:17
-
-
Save iRusel/22e927fe9de5291e0cfd72c70a8e50a0 to your computer and use it in GitHub Desktop.
pascal 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const | |
N = 8; | |
var | |
mas: array[1..N, 1..N] of integer; | |
m, i, j, k, max: integer; | |
begin | |
randomize; | |
for i := 1 to N do | |
begin | |
for j := 1 to N do | |
begin | |
mas[i, j] := random({54+14+1=}69) - 14; | |
write(mas[i, j]:4) | |
end; | |
writeln | |
end; | |
max := mas[1, 1]; | |
k := 1; | |
for i := 2 to N do | |
if mas[i, i] > max then | |
begin | |
max := mas[i, i]; | |
k := i; | |
end; | |
writeln('max string = ', k); | |
write('m (1..8) = '); | |
readln(m); | |
for i := 1 to N do | |
begin | |
j := mas[k, i]; | |
mas[k, i] := mas[m, i]; | |
mas[m, i] := j | |
end; | |
for i := 1 to N do | |
begin | |
for j := 1 to N do write(mas[i, j]:4); | |
writeln | |
end; | |
readln | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment