hey, im really struggling displaying the maximum value in this array, i have managed to get the average and etc but getting it to display the maximum and minimum value in the array is proving to be hard can anyone help?
heres what i have so far
Program arrayz;
uses crt;
Const
MAX = 5;
VAR
marks : array [1..MAX] of integer;
loop : integer;
answer : integer;
average : integer;
begin
answer := 0;
average:= 0;
for loop := 1 to MAX do
begin
write('enter an integer :');
readln (marks [loop]);
end;
for loop := MAX downto 1 do
begin
Writeln('the numbers entered are ', marks [loop]);
end;
delay (2000);
for loop := 1 to max do
begin
answer := answer + marks[loop];
end;
begin
writeln ('the result of adding them together is: = ',answer, ' now press enter');
readln;
end;
begin
average := answer DIV MAX;
writeln ('the average is: ',average);
readln;
end;
end.
thanks in advance for any help