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 5316KB
stdin
Standard input is empty
stdout
Matrix7*8Y=
  0|-25|-16| 11| 47|-11| 24|  1|
-40|-28| 10| -6|-31|-14|-24| -7|
-24| 10|-18|-14|-25| 47|-24|-48|
-22| 43| 31|-19| 30| 35| 32| 24|
 19|-25| -9| 31| 13|-46|-33| 15|
 43|-50| 34| 27|  0|-24| 40| 20|
 43| 13|-33|-46|-15|-10| -3| 37|
colum1max= 43
colum2max= 43
colum3max= 34
colum4max= 31
colum5max= 30
colum6max= 47
colum7max= 40
colum8max= 37
Result:
  43  43  34  31  30  47  40  37