program batavg; uses crt; {-------------------------------------------------------------------------- This program will ask for the number of times you have been at bat, how many times you've been walked, and how many hits you've gotten. It will then compute your batting average. --------------------------------------------------------------------------} VAR h,w,t:real; again:char; n:integer; begin clrscr; textcolor(red + blink); writeln ('FIND YOUR BATTING AVERAGE!!!!'); repeat if again = 'y' then clrscr; textcolor (green); writeln; writeln; write ('How many times have you been at bat? ---> '); readln (t); writeln; write ('Alright, how many times have you been walked? ---> '); readln (w); writeln; write ('And finally, how many hits do you have? ---> '); readln (h); h := h / (t - w); writeln; textcolor(red); writeln; writeln ('Your batting average is ',h:0:3); writeln; writeln; writeln ('Would you like to compute another batting average?'); write ('Type "y" for yes, "n" for no'); again := readkey; until again = 'n'; end.