Код Pascal:
Const
n = 13;
Type
Mass = array[1..n] of real;
Function KL(Var A:Mass; c:real):integer;
Var
k,i:integer;
Begin
k:=0;
For i:= 1 to n do
if A[i] > c then k:=k+1;
KL:=k;
End;
Var
A:Mass;
i:integer;
c:real;
Begin
Randomize;
Write('A(',n,'):');
For i:= 1 to n do
Begin
A[i]:=random*21-10;
Write(' ',A[i]:0:3);
End;
WriteLn;
Write('c = ');ReadLn(c);
WriteLn('k = ',KL(A,c))
End.
Пример работы программы:
A(13): -2.768 10.516 -3.518 9.286 5.555 1.039 1.225 -6.135 8.743 7.440 -3.979 6.129 -7.982
c = 3
k = 6