/* The fuel tank program taken from the ihypress.net Web site */ #include #define CAPACITY 5000 /* fuel tank capacity (liters) */ int main (void) { double supply, pumped; /* all in liters */ /* ask user for initial supply already in tank */ printf ("Enter the the initial supply: "); scanf ("%lf", &supply); /* the program loops until supply falls below 10% */ while (supply > CAPACITY * 0.10) { /* ask user for quantity removed or delivered */ printf ("\nEnter the amount delivered(+)/removed(-): "); scanf ("%lf", &pumped); supply = supply + pumped; /* test so that you don't pump more when tank is empty */ if (supply < 0.0) supply = 0.0; /* test so that you don't fill more when tank is full */ if (supply > CAPACITY) supply = CAPACITY; } printf ("\nSupply below 10%% (%.2lf l remaining)\n", supply); return (0); } /* Enter the the initial supply: 2000 Enter the amount delivered(+)/removed(-): -900 Enter the amount delivered(+)/removed(-): 1100 Enter the amount delivered(+)/removed(-): -1400 Enter the amount delivered(+)/removed(-): -200 Enter the amount delivered(+)/removed(-): -250 Supply below 10% (350.00 l remaining) */