I have to create a program that uses 2 loops to calculate the average of any number of grades, and run the program any number of times. So far this is what I have, I'm sure it's at least 99% wrong, but if someone could please help me get in the right direction, that would be great.
Var num, sum, max, i, average : double, n:integer
Begin
if (num>0) and (num<=max) then begin
for i := 1 to num do begin
write ('Enter grade');
readln(grades);
end;
average := (sum/n);
writeln ('The average is' , average);
End.