Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Test1a;
- var
- matrix : array[1..4,1..4] of integer;
- max, k, sum, i, j, n: integer;
- check : boolean;
- begin
- k:=0;
- sum:=0;
- max:=0;
- n := 4;
- check := true;
- for i := 1 to n do
- for j := 1 to n do
- matrix[i,j] := Random(10);
- for i := 1 to n do begin
- writeln();
- for j := 1 to n do
- write(matrix[i,j]);
- end; writeln();
- for i:=1 to n do
- for j:=1 to n do
- if i=j then if max < matrix[i,j] then
- max := matrix[i,j];
- write('Max элемент на диагонали: ');
- writeln(max);
- for i:=1 to n do
- for j:=1 to n do
- if max < matrix[i,j] then check := false;
- for i:=1 to n do
- for j:=1 to n do begin
- if ((j = 4) AND (i = 1)) OR ((j = 3) AND (i = 2)) OR ((j = 2) AND (i = 3)) OR ((j = 1) AND (i = 4)) then
- k := k+1;
- sum := sum + matrix[i,j];
- end;
- end;
- for i:=1 to n do
- begin
- sum := sum + matrix[i,5-i];
- end;
Add Comment
Please, Sign In to add comment