The Rule:

s:=0;

Loop i:=1 To N

s:=s+T*;
End of Loop;
Out:s;
By FlamingClaw*

```
{
Question
Add together the elements of an array
s:=0
Loop i:=1...N
s:=s+T[i]
End of Loop
Out: s
}
Program Solution01;
Const n=20;
Var i,s:Integer;
T:Array[1..n]Of Integer;
Begin {main}
WriteLn('First run: 1..',n);
For i:=1 To n Do Begin
T[i]:=i;
Write(T[i]:2,' ');
End;
WriteLn;
Write('Add this numbers together:');
s:=0;
For i:=1 To n Do s:=s+T[i];
{write the results to the screen}
WriteLn(s);
Write('Press enter to quit..');
ReadLn;
End.{end of main}
{
-= 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=-
}
```

About the Author

Just living in hungary.Teaching myself in pascal.

I have time to programming when I'm going to home,cause my job is not a good place for that.

Don't forget that if you ask something on the forum and you got the right answer then

[b] mark as solved !![/b]