Which Has a Larger Volume a Cylinder or a Truncated Cone? The following link describes a programming problem. However, I am unable to work out the maths for the problem.

We are given $r$ – radius of lower base and $s$ – slant height. The figure can be cylinder or truncated cone. You have to find as largest volume as possible to carry oil respect to given information.
You are given two numbers that less than 100: radius $r$ of lower base and slant height $s$. The slant height is the shortest possible distance between the edges of two bases.

EDIT suggested :
Given $ \sqrt{(R-r)^2 + h^2 }$ and $ r,$  find $ h/r $ ratio.
$~~~~~~~~~~~~~~~~$

See on comparing volume we get to see that volume of cylinder $<$ volume of truncated cone as $r^2<(r^2+R^2-rR)$. Thus from here you can setup equations and differentiate it with radius and then put it to be $0$ for maxima and the condition for maxima is $f''(x)<0$
