SHARE
TWEET

Untitled

a guest Mar 15th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. uses crt;
  2. const
  3. len = 5;
  4. var
  5. i, j, k: integer;
  6. top, left, right, bottom: integer;
  7. top_diag, left_diag, right_diag, bottom_diag: integer;
  8. a_array: array[1..len] of array[1..len] of integer;
  9. b_array: array[1..len] of array[1..len] of integer;
  10. begin
  11. randomize;
  12. for i:=1 to len do begin
  13.     for j:=1 to len do begin
  14.         a_array[i,j] := random(25);        
  15.     end;
  16. end;
  17. for i:=1 to len do begin
  18.     for j:=1 to len do begin
  19.         if (i = 1) then
  20.             top:=a_array[len, j]
  21.         else
  22.             top:=a_array[i-1, j];
  23.         if (j = 1) then
  24.             left:=a_array[i, len]
  25.         else
  26.             left:=a_array[i, j-1];
  27.         if (j = len) then
  28.             right:=a_array[i, 1]
  29.         else
  30.             right:=a_array[i, j+1];
  31.         if (i = len) then
  32.             bottom:=a_array[1, j]
  33.         else
  34.             bottom:=a_array[i+1, j];
  35.     end;
  36. end;
  37. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top