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.Code:Enter gallons consumed(-1 to end): -1 //skips the miles prompt and ends the loop ...some code after loop...
here's the code:
Thanks,Code:while (gallon != -1) { printf("Enter gallons consumed(-1 to end): "); scanf("%f", &gallon); printf("Enter miles: "); scanf("%f", &miles); tmil += miles; tgal += gallon; mpg = miles/gallon; printf("Your fuel efficiency is %.2f\n\n", mpg); }
Jann



LinkBack URL
About LinkBacks


