If I am understanding your program correctly, It will not calculate overall average of miles/gallon. If you want to calculate average, you need to keep track number of inputs, and perform addition of each calculation of miles/gallon and then divide sum from number of input.
for eg For given 3 input 22.421875 ,19.417475 ,24.000000
overall average = (22.421875 + 19.417475 + 24.000000)/3
I didn’t run this program on any compiler but somehow i am not able to see this average calculation in the program.
Please feel free to revert back.