program AvgDigits;
{ read in digits without blanks, separate them, and compute their average }
var NumDigits, I, Sum, Score: integer;
Average: real;
CharRead : Char;
begin
writeln(' How many digits would you like averaged?');
readln(NumDigits);
writeln(' please enter your digits without spaces');
sum := 0;
for I := 1 to NumDigits do
begin
read(CharRead);
{subtract the ord('0') from the ordinal value of the character
just read to get the score}
Score := ord(CharRead) - ord('0'); {note the quotes}
Sum := Sum + Score;
end;
Average := Sum/NumDigits;
writeln('the average is', Average:5:2);
end.