Program PR1; uses crt; var mas:array[1..10,1..10] of integer; i,j,b:integer; Begin clrscr; randomize; for i:=1 to 10 do for j:=1 to 10 do mas[i,j]:=random(10); for i:=1 to 10 do for j:=1 to 10 do begin gotoxy(j,i); write(mas[i,j]); end; b:=0; for i:=1 to 10 do for j:=1 to 10 do if (j=i) and (mas[i,j]=0) then b:=b+mas[i,j]; writeln; writeln(b); end.
Answers & Comments
Program PR1;
uses crt;
var mas:array[1..10,1..10] of integer;
i,j,b:integer;
Begin
clrscr;
randomize;
for i:=1 to 10 do
for j:=1 to 10 do mas[i,j]:=random(10);
for i:=1 to 10 do
for j:=1 to 10 do begin
gotoxy(j,i);
write(mas[i,j]);
end;
b:=0;
for i:=1 to 10 do
for j:=1 to 10 do if (j=i) and (mas[i,j]=0) then b:=b+mas[i,j];
writeln;
writeln(b);
end.