Procedure TForm1.Button1Click(Sender: TObject); var i1,i2,i3 : Integer; kk : Integer; Chislo : Integer; begin Memo1.Clear; kk := 0; for i1 := 1 to 9 do for i2 := 0 to 9 do for i3 := 0 to 9 do if ( (i1<>i2) and (i1<>i3) and (i2<>i3) ) then if ( Frac((i1+i2+i3)/7)=0 ) then begin Chislo := i1*100 + i2*10 + i3; if ( Frac(Chislo/7)=0 ) then begin Memo1.Lines.Append(inttostr(Chislo)); inc(kk); end; end; end;
//Pascal ABC.NET Версия 2.2 Сборка 790 var ma:array[1..10,1..10] of integer; ar:array[1..10] of integer; i,j,s:integer; begin; randomize; writeln('Matrix:'); for i:=1 to 10 do begin; writeln; for j:=1 to 10 do begin; ma[i,j]:=random(-10,10); write(ma[i,j]:5); if ma[i,j]<0 then ar[i]+=ma[i,j]; end; end; writeln; writeln('Final array:'); for i:=1 to 10 do writeln(ar[i]); end.
var
i1,i2,i3 : Integer;
kk : Integer;
Chislo : Integer;
begin
Memo1.Clear;
kk := 0;
for i1 := 1 to 9 do
for i2 := 0 to 9 do
for i3 := 0 to 9 do
if ( (i1<>i2) and (i1<>i3) and (i2<>i3) ) then
if ( Frac((i1+i2+i3)/7)=0 ) then
begin
Chislo := i1*100 + i2*10 + i3;
if ( Frac(Chislo/7)=0 ) then
begin
Memo1.Lines.Append(inttostr(Chislo));
inc(kk);
end;
end;
end;
var ma:array[1..10,1..10] of integer;
ar:array[1..10] of integer;
i,j,s:integer;
begin;
randomize;
writeln('Matrix:');
for i:=1 to 10 do
begin;
writeln;
for j:=1 to 10 do
begin;
ma[i,j]:=random(-10,10);
write(ma[i,j]:5);
if ma[i,j]<0 then ar[i]+=ma[i,j];
end;
end;
writeln;
writeln('Final array:');
for i:=1 to 10 do
writeln(ar[i]);
end.
Пример вывода:
Matrix:
9 -1 3 -10 6 3 -9 8 5 -6 -4 4 -6 7 7 7 -10 4 -2 3 -9 -3 10 -9 2 -7 1 -8 -8 -8 -5 -4 2 -5 -9 -9 3 6 7 -5 3 8 10 0 -9 4 -3 6 -10 -9 9 10 -8 1 -1 2 -1 1 -2 3 -8 10 5 3 10 -10 -8 9 6 6 -6 -5 8 -7 -10 -7 -2 -1 -10 9 7 5 -9 -10 -6 -5 -7 -9 7 -1 2 -9 -2 -6 -8 4 -7 -3 1 -9
Final array:
-26
-22
-52
-37
-31
-12
-26
-48
-47
-44