Guest User

Untitled

a guest
Jan 20th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. program Test1a;
  2. var
  3. matrix : array[1..4,1..4] of integer;
  4. max, k, sum, i, j, n: integer;
  5. check : boolean;
  6. begin
  7. k:=0;
  8. sum:=0;
  9. max:=0;
  10. n := 4;
  11. check := true;
  12.  
  13.  
  14. for i := 1 to n do
  15. for j := 1 to n do
  16. matrix[i,j] := Random(10);
  17.  
  18. for i := 1 to n do begin
  19. writeln();
  20. for j := 1 to n do
  21. write(matrix[i,j]);
  22. end; writeln();
  23.  
  24. for i:=1 to n do
  25. for j:=1 to n do
  26. if i=j then if max < matrix[i,j] then
  27. max := matrix[i,j];
  28.  
  29. write('Max элемент на диагонали: ');
  30. writeln(max);
  31.  
  32. for i:=1 to n do
  33. for j:=1 to n do
  34. if max < matrix[i,j] then check := false;
  35. for i:=1 to n do
  36. for j:=1 to n do begin
  37. 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
  38.  
  39. k := k+1;
  40. sum := sum + matrix[i,j];
  41. end;
  42. end;
  43.  
  44. for i:=1 to n do
  45. begin
  46. sum := sum + matrix[i,5-i];
  47. end;
Add Comment
Please, Sign In to add comment