Volume of a cylinder = circular area x length. Circular area = Pi x r^2 (pie are square) Pi = 3.14 r = radius or 1/2 diameter. Divide diameter (3) by 2 and square that number. Multiply that by Pi (3.14) to find circular area in square inches. Convert 20 feet to inches by multiplying by 12 (1 foot = 12 inches) Now multiply that by circular area and answer will be in cubic inches. 1 gallon = 231 cubic inches. Divide 231 into last answer for gallons of water.
For this, we need to look at the volume contained in the pipe. We'll assume for now that the 3 inch diameter is the internal diameter, to make this simpler. Thus, we have a 1.5 inch radius, so the cross-sectional area of the pipe would be pi*(1.5in)^2 = 2.25pi in^2. To obtain the volume of a cylinder, we then take the height of the cylinder multiplied by the base area (as with all regular prisms). Thus the 20 foot (20feet*12in/ft = 240in) height multiplied by the base area is 540pi in^3. This turns out to be near 1696.46in^3. We then apply the unit conversion of ~0.554 fluid ounces/in^3 to 1696.46in^3 and we have 939.84 fluid ounces. This finally is applied to the conversion 1 gallon/128fluid ounces to achieve 7.3429 gallons.Alternatively, you can type this into google to get: 540 * pi (in^3) = 7.34398283 US gallons.Hope this helps.