Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 31st, 2013, 07:19 PM
FN_FREDDY FN_FREDDY is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 1 FN_FREDDY User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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
{$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

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > Pascal Help!

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

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


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap