Solved

# Averages Program

Posted on 1999-11-18

I am having a bit of a problem completing this task and i was hoping someone could help me! I'm only using simple pascal language. Heres the question:

Design a program that accepts numbers (ending with -999 as a rogue value) and the prints out the average and also each number input. Beside each number is the difference from the average (obtained by subtracting the average from it).

So theres the question! And heres the program i have done so far...except its not very good and doesn't work yet!! Also i have to use an array with VERY SIMPLE LANGUAGE!!! Heres my program:

Program Averages;

Uses Crt;

VAR

numbers:array[1..100] of integer;

number,total,difference,i:integer;

average:real;

Procedure Main;

Begin

Clrscr;

writeln('Averages Program');

Total:=0;

For i:=1 to 10 {amount in list} do

Begin

readln(numbers[i]);

total:=total+numbers[i];

average:=total/10;

difference:=numbers[i]-average;

End;

writeln('',number,' ',difference);

writeln('The Average is ',average);

End.

Please please could someone, anyone help me?!?!

Thanks.