Վայ, ներողություն եմ խնդրում, էն վերևի տեղադրածս խնդրի pascal-ի տարբերակը սխալն եմ տեղադրել
ճիշտը էս ա

  1. uses crt;
  2. type matric=array[1..40,1..40] of integer;
  3. var a,b,s:matric;
  4. i,j,n,m,k:integer; t:boolean;
  5. procedure baz(var a,b,s:matric; n:integer);
  6. var i,j,k:integer; c:matric;
  7. begin
  8. for i:=1 to n do
  9. for j:=1 to n do
  10. begin
  11. c[i,j]:=0;
  12. for k:=1 to n do
  13. c[i,j]:=c[i,j]+a[i,k]*b[k,j];
  14. end;
  15. { readkey; }
  16. for i:=1 to n do
  17. begin
  18. for j:=1 to n do
  19. begin
  20. { write(b[i,j]);}
  21. b[i,j]:=c[i,j];
  22. s[i,j]:=s[i,j]+b[i,j]
  23. end;
  24. { writeln; }
  25. end;
  26. end;
  27. begin
  28. repeat
  29. write('n=');
  30. read(n);
  31. until(n>1) and (n<=40);
  32. for i:=1 to n do
  33. for j:=1 to n do
  34. begin
  35. a[i,j]:=0;
  36. b[i,j]:=0;
  37. s[i,j]:=0;
  38. end;
  39. repeat
  40. write('m=');
  41. read(m);
  42. until(m>1);
  43. write('mutqagreq tver@');
  44. writeln;
  45. for k:=1 to m do
  46. begin
  47. read(i,j);
  48. { writeln;}
  49. a[i,j]:=1;
  50. b[i,j]:=1;
  51. s[i,j]:=1;
  52. end;
  53. k:=0;
  54. repeat
  55. t:=false;
  56. for i:=1 to n do
  57. begin
  58. for j:=1 to n do
  59. if b[i,j]<>0 then
  60. begin
  61. t:=true;
  62. k:=k+1;
  63. break
  64. end;
  65. if t=true then break
  66. end;
  67. if t=true then
  68. baz(a,b,s,n)
  69. until t=false;
  70. writeln('k=',k);
  71. for i:=1 to n do
  72. begin
  73. for j:=1 to n do
  74. write(s[i,j]);
  75. writeln;
  76. end;
  77. readkey;
  78. end.