```
{
Question
Counts that how many propertied elements are in the array
example:negative numbers
The rule:
s:=0;
Loop i:=1..N
If T[i]<0 Then s:=s+1;
End of Loop;
Out: s;
}
Program Solution01;
Const n = 5;
m = -10;
Var s,i:Integer;
T:Array[m..n]Of Integer;
Begin {main}
WriteLn('First run:');
{create random numbers and fill the array with them}
Randomize;{it is important!}
For i:=m To n Do Begin
T[i]:=Random(m)+n; {-10..5}
Write(T[i]:3);
End;
WriteLn;
{analizing}
s:=0;
For i:=m To n Do Begin
If (T[i] < 0) Then s:=s+1;
End;
{write the number of negative numbers}
Write('The number of negative numbers: ',s);
ReadLn;
End.
{
-= Note By FlamingClaw =-
All programs created by me are written and tested
in Dev Pascal and/or Turbo Pascal 7.0
Of course working!
-= Created By FlamingClaw =-
-=2009.04.05=-
}
```

1

Contributor0

Replies1

Views**Are you able to help answer this sponsored question?**

Questions asked by members who have earned a lot of community kudos are featured in order to give back and encourage quality replies.

Recommended Topics