Code:
int start = 10;
int end = 20;
const double litersPerGallon = 3.785; //edit: not constant, const
double liters = 0.0;
printf("gallons to liters, from 10 to 20:\n");
while ( start <= end )
{
liters = start * litersPerGallon;
printf("\n %d gallons is %4.3lf liters", start, liters);
start++;
}
This is a bit of a gift, but take it and use a similar logic, to do the second part of your assignment.
You need to "marinate" in this kind of logic, because it's quite basic, and used all the time. Let it soak in, very well.