//The problem with my programm is when i try to come out of the loop by entering -1 it does not...Plz help me out guys i need help ....
// Puttsardara dey (KAZDAX)
#include <stdio.h>
int main()
{
int avg, gal, drive, cnt ,mg;
cnt = 1;
clrscr();
while ( gal != -1 ){
printf("\nEnter the gallons used ( -1 to end ): ");
scanf("%d", &gal);
printf("\nEnter the miles driven: ");
scanf("%d", &drive);
mg = drive/gal;
printf("\nThe miles / gallon for this tank was %d\n",mg);
cnt++;
}
if ( gal == -1 ) {
avg = mg/cnt;
printf("\nThe overall average miles/gallon for this tank was %d\n",avg);
}
getch();
return 0;
}