January 31st, 2013, 07:19 PM

Pascal Help!
Excuse me. I am a total noob when it comes to Pascal. Right now I am having problems with arrays. No matter what, I can't find a way to add the values within the array.
First, the user must be able to add the amount of numbers that he wants.
Second, he must be able to add any numbers
Third, I need to calculate the average.
Here is my work:
program_Numbers;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes
{ you can add units after this };
{$R *.res}
Var
F: array[1..100] of integer;
A,B,C: integer;
x: integer;
Final_Sum: real;
Sum: real;
Begin
writeln('Please add the amount of numbers plus the numbers that');
writeln('you wish to entre.');
writeln;
Readln(x);
Sum:= 0;
For A:= 1 to x do
readln(F[A]);
writeln;
writeln;
For B:= 1 to x do
writeln('Grades[',B,']=', F[B]);
Repeat
F[C] := C + F[A];
Final_Sum:= Sum + F[C];
C:= C + 1;
Until C = x;
writeln('Sum: ', Final_Sum:0:2);
writeln('Average: ', Final_Sum/x:0:2);
writeln;
writeln;
writeln(' >Press Entre to Quit<');
Readln();
End.
I appreciate your help. And, thank you.
Please don't think that I am asking you to do my work. I just don't know what the missing piece of the puzzle is. I just need someone to tell me and I'll do the rest, because I am unable to learn if someone does it for me.
Last edited by FN_FREDDY; February 2nd, 2013 at 09:11 PM.
Reason: Misunderstanding