fork download
  1. program lab5(input, output);
  2. const
  3. n = 7;
  4. m = 8;
  5. var
  6. Y: array[1..n, 1..m] of integer;
  7. Z: array[1..m] of integer;
  8. i, j, max_val: integer;
  9. begin
  10. randomize;
  11.  
  12. for i := 1 to n do
  13. for j := 1 to m do
  14. Y[i, j] := random(100)-50;
  15. writeln('Matrix',n,'*',m, 'Y=');
  16. for i := 1 to n do
  17. begin
  18. for j := 1 to m do
  19. write(Y[i, j]:3, '|' );
  20. writeln;
  21. end;
  22. for j := 1 to m do
  23. begin
  24. max_val := Y[i, j];
  25. for i := 2 to n do
  26. begin
  27. if Y[i, j] > max_val then
  28. max_val := Y[i, j];
  29. end;
  30. Z[j] := max_val;
  31. writeln('colum',j,'max=',Z[j]:3)
  32. end;
  33. writeln('Result:');
  34. for j := 1 to m do
  35. write(Z[j]:4);
  36. writeln;
  37. readln;
  38. end.
  39.  
Success #stdin #stdout 0s 5296KB
stdin
Standard input is empty
stdout
Matrix7*8Y=
 29| 28| 38|-32| 26| 45| 49| 33|
-29|-31| -5| 25| 21|-16|  8|-33|
 44| 41|-17| -9| 26|  1|-35|-46|
 13|-20|-22|-28|  4| 47|  0|-28|
 -1|  2|-22|-35| 24|-37|-32|-24|
 18| 22|-46|-34| -4| 23|-21|  8|
-21|-31|-34| 15| 42| -9| 45|-41|
colum1max= 44
colum2max= 41
colum3max= -5
colum4max= 25
colum5max= 42
colum6max= 47
colum7max= 45
colum8max=  8
Result:
  44  41  -5  25  42  47  45   8