Первая программа может выглядеть так:
uses crt;
const n=10;
type Mas=array [1..n] of integer;
Var A: Mas;
i, x:integer;
priznak: boolean;
Begin
ClrScr;
priznak:=false;
WriteLn(' Massiv: ');
for i:=1 to n do
begin
A[i]:=-100+random(200);
Write(A[i]:5);
end;
WriteLn;
Write(' X = '); ReadLn(X);
WriteLn;
for i:=1 to n do
if X=A[i] then
begin
WriteLn (' X = ', A[i], ' Index = ', i);
priznak:=true;
end;
if priznak=false then Writeln (' None...');
ReadLn;
end.
2. А вот реверс:
uses crt;
const n=10;
type Mas=array [1..n] of integer;
Var A: Mas;
i:integer;
Begin
ClrScr;
WriteLn(' Massiv: ');
for i:=1 to n do
begin
A[i]:=-100+random(201);
Write(A[i]:5);
end;
WriteLn;
WriteLn(' Revers: ');
for i:=n downto 1 do
Write(A[i]:5);
WriteLn;
ReadLn;
end.
И. наконец, последняя программа:
uses crt;
const n=5;
var i, x : integer;
P:longint;
begin
ClrScr;
P:=1;
WriteLn(' Wwod Massiva: ');
for i:=1 to n do
begin
ReadLn (x);
P:=P*x;
end;
WriteLn;
WriteLn(' P = ', P);
WriteLn;
ReadLn;
end.