Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

#1
January 31st, 2013, 07:19 PM
 FN_FREDDY
Registered User

Join Date: Jan 2013
Posts: 1
Time spent in forums: 1 h 1 m 36 sec
Reputation Power: 0
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
{\$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('you wish to entre.');
writeln;

Sum:= 0;
For A:= 1 to x do
writeln;
writeln;

For B:= 1 to x do

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<------');

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

 Viewing: Dev Shed Forums > Other > Beginner Programming > Pascal Help!