Gallons is a measurement of volume, so you need to first figure out how many cubic inches are held by your tank, then convert that to gallons.
For the first step, you need to know the area of the round base of the tank and multiply by its length. The area of the base is calculated using the area of a circle:
A = PI r2. Remember that the radius is half the diameter.
Now that you have the volume in cubic inches, you need to convert to gallons. I know of at least two different sizes of gallons - one used in the UK and one in the US. They therefore have different conversion values - you would need to divide the volume you obtained in the first step by the appropriate conversion for the kind of gallons you mean.
1 gallon (UK "Imperial units") = 277.42 cubic inches
1 gallon (US) = 231 cubic inches
As an aside, in most of the world, we use SI units (System International), so we would measure distances in meters (or centimeters) and volume in liters. These units make calculations like yours really easy because most units in SI are base-ten; 1 liter = 1000 cubic centimeters, which in turn means 1000 milliliters.
Hope this helps you!
Stephen La Rocque>