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 5292KB
stdin
Standard input is empty
stdout
Matrix7*8Y=
-12| -2| 18|-42|-50| 25| 25| -6|
 -3| 41|-30|-23|-35| -3|-38| -8|
 26|-44|-46|  9|  9| 36|-17|-45|
 42|-26|-39| 11|-47|-23| 21|-19|
 22|  7| 41| 22| 28| 11|-44| 42|
 35| -8| 24|-10|-19| 12| -9|-12|
-20| -7|-32| 31|-21| 32|  2|-15|
colum1max= 42
colum2max= 41
colum3max= 41
colum4max= 31
colum5max= 28
colum6max= 36
colum7max= 21
colum8max= 42
Result:
  42  41  41  31  28  36  21  42