Program Diagonal; uses Crt; const n = 5; Type Mas = array [1..n, 1..n] of integer; Vec = array [1..n*n] of integer; var A: Mas; V: Vec; i, j , k: integer; p : longint; begin ClrScr; Randomize; p:=1; WriteLn('Massiv A:'); for i:=1 to n do begin for j:= 1 to n do begin A[i, j]:= 1+random (9); p:=p*A[i,i]; Write(A[i, j]:4); end; WriteLn; WriteLn; end; k:=0; for i:=1 to n do for j:=1 to n do begin if (A[i,j]>p) and (j<i) then begin k:=k+1; V[k]:=A[i, j]; end; end; WriteLn('Vector V='); for j:=1 to k do Write(V[j]:4);
WriteLn; if k=0 then Writeln ('None'); ReadLn; end.
Var abcd,a,b,c,d:integer; begin abcd:=4579; a:=abcd div 1000; b:=abcd div 100 mod 10; c:=abcd div 10 mod 10; d:=abcd mod 10; Writeln(a,b,c,d); Writeln(a,c,b,d); Writeln(b,a,c,d); Writeln(b,c,a,d); Writeln(c,a,b,d); Writeln(c,b,a,d); Writeln(a,d,b,c); Writeln(a,d,c,b); Writeln(b,d,a,c); Writeln(b,d,c,a); Writeln(c,a,d,b); Writeln(c,b,d,a); Writeln(a,b,d,c); Writeln(a,c,d,b); Writeln(d,b,a,c); Writeln(d,b,c,a); Writeln(d,c,a,b); Writeln(d,c,b,a); end. Громозко, да? Я не помню, как делать это через функцию. Думаю, и так сойдет.
uses Crt;
const n = 5;
Type Mas = array [1..n, 1..n] of integer;
Vec = array [1..n*n] of integer;
var A: Mas;
V: Vec;
i, j , k: integer;
p : longint;
begin
ClrScr;
Randomize;
p:=1;
WriteLn('Massiv A:');
for i:=1 to n do
begin
for j:= 1 to n do
begin
A[i, j]:= 1+random (9);
p:=p*A[i,i];
Write(A[i, j]:4);
end;
WriteLn; WriteLn;
end;
k:=0;
for i:=1 to n do
for j:=1 to n do
begin
if (A[i,j]>p) and (j<i) then
begin
k:=k+1;
V[k]:=A[i, j];
end;
end;
WriteLn('Vector V=');
for j:=1 to k do
Write(V[j]:4);
WriteLn;
if k=0 then Writeln ('None');
ReadLn;
end.
begin
abcd:=4579;
a:=abcd div 1000;
b:=abcd div 100 mod 10;
c:=abcd div 10 mod 10;
d:=abcd mod 10;
Writeln(a,b,c,d);
Writeln(a,c,b,d);
Writeln(b,a,c,d);
Writeln(b,c,a,d);
Writeln(c,a,b,d);
Writeln(c,b,a,d);
Writeln(a,d,b,c);
Writeln(a,d,c,b);
Writeln(b,d,a,c);
Writeln(b,d,c,a);
Writeln(c,a,d,b);
Writeln(c,b,d,a);
Writeln(a,b,d,c);
Writeln(a,c,d,b);
Writeln(d,b,a,c);
Writeln(d,b,c,a);
Writeln(d,c,a,b);
Writeln(d,c,b,a);
end.
Громозко, да? Я не помню, как делать это через функцию. Думаю, и так сойдет.