Var
a:array[1..10] of integer;
b,i,k:integer;
begin
Randomize;
Write('Введите количество элементов в массиве: ');
for i:=1 to 10 do
begin
a[i]:=Random(21)-10;
Write(a[i],' ')
end;
Writeln;
Write('Какое число искать? ');
Readln(b);
k:=0;
for i:=1 to 10 do
if a[i]=b then Inc(k);
Writeln('Число встречается ',k,' раз')
end.
Подробнее - на Znanija.com -
znanija.com/task/29303328#readmore
{$APPTYPE CONSOLE}
Const
n = 13;
Type
Mass = array[1..n] of integer;
Procedure BbIBOD(Var A:Mass);
Var
i:integer;
Begin
For i:= 1 to n do
Write(' ',A[i])
End;
Function SWP(Var A:Mass; c:real):integer;
Var
i,j:integer;
Begin
For i:= 1 to n do
if (A[i] < 0)and(A[i] <= c) then j:=i;
if j <> 0 then
Begin
WriteLn('Искомый элемент: ',A[j],'[',j,']');
A[j]:=Sqr(A[j]);
i:=A[n-1];
A[n-1]:=A[j];
A[j]:=i;
Write('Новый массив:');
BbIBOD(A);
End
else Write('В массиве нет отрицательных элементов')
End;
Var
A:Mass;
i:integer;
c:real;
Begin
Randomize;
Write('Исходный массив(',n,'):');
For i:= 1 to n do
A[i]:=random(2*n+1)-n;
BbIBOD(A);
WriteLn;
Write('Введите число: ');
ReadLn(c);
SWP(A,c);
ReadLn
End.
1-3 2-2 3-2 4-4 вроде как