Int a:array[1..4, 1..4] of integer; i, j, k: integer; begin k:=0; for i:=1 to 4 do for j:=1 to 4 do begin readln(a[i, j]); If (i=j) and (a[i] < 0) and (a[i] mod 2 = 0) then k:= k+1; end; writeln(k); end.
nastyamagma
нужно только на главной диагонали искать
Galina2013
условие i = j будет оставлять элементы на главной диагонали
Galina2013
var int a:array[1..4, 1..4] of integer; i, j, k: integer; begin k:=0; for i:=1 to 4 do for j:=1 to 4 do begin readln(a[i, j]); If (i=j) and (a[i] < 0) and (a[i] mod 2 = 0) then k:= k+1; end; writeln(k); end.
Galina2013
var a:array[1..4, 1..4] of integer; i, j, k: integer; begin k:=0; for i:=1 to 4 do for j:=1 to 4 do begin readln(a[i, j]); If (i=j) and (a[i, k] < 0) and (a[i, k] mod 2 = 0) then k:= k+1; end; writeln(k); end.
Galina2013
var a:array[1..4, 1..4] of integer; i, j, k: integer; begin k:=0; for i:=1 to 4 do for j:=1 to 4 do begin readln(a[i, j]); If (i=j) and (a[i, j] < 0) and (a[i, j] mod 2 = 0) then k:= k+1; end; writeln(k); end.
Answers & Comments
Verified answer
Int a:array[1..4, 1..4] of integer;i, j, k: integer;
begin
k:=0;
for i:=1 to 4 do
for j:=1 to 4 do begin
readln(a[i, j]);
If (i=j) and (a[i] < 0) and (a[i] mod 2 = 0) then
k:= k+1;
end;
writeln(k);
end.
i, j, k: integer;
begin
k:=0;
for i:=1 to 4 do
for j:=1 to 4 do begin
readln(a[i, j]);
If (i=j) and (a[i] < 0) and (a[i] mod 2 = 0) then
k:= k+1;
end;
writeln(k);
end.
i, j, k: integer;
begin
k:=0;
for i:=1 to 4 do
for j:=1 to 4 do begin
readln(a[i, j]);
If (i=j) and (a[i, k] < 0) and (a[i, k] mod 2 = 0) then
k:= k+1;
end;
writeln(k);
end.
i, j, k: integer;
begin
k:=0;
for i:=1 to 4 do
for j:=1 to 4 do begin
readln(a[i, j]);
If (i=j) and (a[i, j] < 0) and (a[i, j] mod 2 = 0) then
k:= k+1;
end;
writeln(k);
end.