Counts that how many propertied elements are in the array
example:negative numbers
By FlamingClaw

{
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=-
}
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.