// PascalABC.NET 3.2, сборка 1338 от 16.11.2016 const n=8; begin var a:=MatrixRandom(n,n,10,90); for var i:=0 to n-1 do begin for var j:=0 to n-1 do Write(a[i,j]:3); Writeln end; var k:=0; for var i:=0 to n-1 do if a[i,i].IsEven then Inc(k); Writeln('k=',k); end.
const
n=8;
begin
var a:=MatrixRandom(n,n,10,90);
for var i:=0 to n-1 do begin
for var j:=0 to n-1 do Write(a[i,j]:3);
Writeln
end;
var k:=0;
for var i:=0 to n-1 do
if a[i,i].IsEven then Inc(k);
Writeln('k=',k);
end.
Пример
23 32 75 57 27 14 26 53
46 75 17 68 57 60 10 43
76 10 62 83 62 20 89 15
28 36 71 86 67 13 34 46
84 38 56 90 16 40 19 16
15 39 75 15 23 41 23 70
48 17 50 81 82 18 41 13
33 69 39 82 34 31 77 43
k=3