I'm wondering if something is wrong with this code.
the supposed output should be:
but it still asks for the miles value to be entered and then ends the loop. what's wrong with this? please help.
Enter gallons consumed(-1 to end): -1
//skips the miles prompt and ends the loop
...some code after loop...
here's the code:
while (gallon != -1)
printf("Enter gallons consumed(-1 to end): ");
printf("Enter miles: ");
tmil += miles;
tgal += gallon;
mpg = miles/gallon;
printf("Your fuel efficiency is %.2f\n\n", mpg);