I probably would have done it like this!
I personally would have done it like this.
Code:
#include <stdio.h>
int main()
{
int input_value, final, gallons, milespergallon;
do{
printf("What is your initial odometer reading:\n");
scanf("%d", &input_value);
printf("What is your final odometer reading:\n");
scanf("%d", &final);
printf("What is the number of gallons of gas:\n");
scanf("%d", &gallons);
milespergallon = ( final - input_value ) / gallons;
printf("Miles per gallon: %d", milespergallon);
}while ( input_value > 0 );
return 0;
}
[colour=blue]You probably forgot about this a long time ago, but I just found this thread!![/colour]:-)