Показать сообщение отдельно
  #9  
Старый 24.06.2010, 17:46
ДевочкаBlond ДевочкаBlond вне форума
Прохожий
 
Регистрация: 24.06.2010
Сообщения: 8
Репутация: 10
По умолчанию

Код:
procedure TForm1.Button1Click(Sender: TObject);
var
q:array [1..10,1..10] of integer;
i,j,p:integer;
begin
p:=0;
for i:=1 to 10 do begin
for j:=1 to 10 do begin
if i > j then q[i,j]:=0;

if j>=2 then q[1,j]:=j+1;
if (j>=3) and (i=2) then q[i,j]:=j+2;
if (j>=4) and (i=3) then q[i,j]:=j+3;
if (j>=5) and (i=4) then q[i,j]:=j+4;
if (i>=2) and (j=10) then q[i,j]:=0;
if (i>=4) and (j=9) then q[i,j]:=0;
if (i>=5) and (j<=8) then q[i,j]:=0;
if 11-i=j then q[i,j]:=i;
if i=j then q[i,j]:=i;
if i =10 then q[i,j]:= j+i;
if (q[i,j]>-1) and (q[i,j]< 1) then p:=p+1;
StringGrid1.Cells[j-1,i-1]:=inttostr(q[i,j]);
end;  end;
Edit1.Text:=inttostr(p);
end;
end.


У друга чётвёртое так выглядит.
Ответить с цитированием