Spicke

НА

Jan 17th, 2017
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.68 KB | None | 0 0
  1. uses Compl;
  2.  
  3. const n = 5;
  4.  
  5. var a: array[1..n,1..n] of complex;
  6.     i, j, k: integer;
  7.     S1,S2,S: complex;
  8.  
  9. begin
  10.     Zero(S);
  11.     k := 0;
  12.     for i := 1 to n do
  13.     begin
  14.       for j := 1 to n do
  15.       begin
  16.         a[i,j].Re  :=  random(4) + 1;
  17.         a[i,j].Im  :=  random(4) + 1;
  18.         write(a[i,j].Re, '.', a[i,j].Im);
  19.         write('  ')
  20.       end;
  21.       writeln;
  22.     end;
  23.     writeln;
  24.     for i := 1 to n do
  25.     begin
  26.         Add(a[i,n+1-i],S1,S1);
  27.         inc(k);
  28.     end;
  29.    
  30.     for i := 1 to n do
  31.     begin
  32.         Add(a[i,i],S2,S2);
  33.         inc(k);
  34.     end;
  35.    
  36.     Add(S1,S2,S);
  37.     Prod(1/k,S,S);
  38.     Output(S);
  39.     writeln
  40. end.
Advertisement
Add Comment
Please, Sign In to add comment