
24.06.2010, 17:04
|
Местный
|
|
Регистрация: 31.05.2010
Адрес: Москва
Сообщения: 466
Версия Delphi: 7
Репутация: 40
|
|
4-e
Код:
procedure TForm1.Button1Click(Sender: TObject);
var arr:array[1..10,1..10] of integer;
i,j,kol:integer;
st:string;
begin
for j:=1 to 10 do
for i:=1 to 10 do
begin
if (i<=5) then begin
if (j<=5) then arr[j,i]:=0
else arr[j,i]:=i;
end
else begin
if (j<=5) then arr[j,i]:=i+(j-1)
else arr[j,i]:=0;
end;
end;
kol:=0;
for j:=1 to 10 do
for i:=1 to 10 do
if arr[j,i]>0 then kol:=kol+1;
memo1.Clear;
for i:=1 to 10 do
begin
st:='';
for j:=1 to 10 do
begin
st:=st+inttostr(arr[i,j])+' | ';
end;
memo1.Lines.Add(st);
end;
showmessage('Ненулевых-'+inttostr(kol));
end;
|