hozer

Delphi - lab5

Mar 9th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.82 KB | None | 0 0
  1. program lab5;
  2. var
  3.   n, k, j: integer;
  4.   max: real;
  5.   a, b, x: array[1..15, 1..15] of real;
  6. begin
  7.   writeln('input n: ');
  8.   readln(n);
  9.   if (n < 1) or (n > 15) then
  10.     writeln('Error: n not in [1, 15].')
  11.   else
  12.   begin
  13.     writeln('input matr a: ');
  14.     for k:=1 to n do
  15.         for j:=1 to n do
  16.             readln(a[k][j]);
  17.  
  18.     writeln('input matr b: ');
  19.     for k:=1 to n do
  20.         for j:=1 to n do
  21.             readln(b[k][j]);
  22.  
  23.     for k:=1 to n do
  24.       begin
  25.          max := b[k][1];
  26.          for j:= 2 to n do
  27.             if max < b[k][j] then
  28.               max := b[k][j];
  29.  
  30.          for j:= 1 to n do
  31.             x[k][j] := a[k][j] * max;
  32.       end;
  33.  
  34.     for k:=1 to n do
  35.       begin
  36.         for j:=1 to n do
  37.           write(x[k][j]:0:2, ' ');
  38.         writeln;
  39.       end;
  40.   end;
  41.   readln;
  42. end.
Advertisement
Add Comment
Please, Sign In to add comment