Volume of biggest sphere within a right circular cylinder | Java Program to find the biggest sphere that can be fit within a right circular cylinder ; Function to find the biggest sphere ; radius and height cannot be negative ; radius of sphere ; Driver code
import java . io . * ; class GFG { static float sph ( float r , float h ) { if ( r < 0 && h < 0 ) return - 1 ; float R = r ; return R ; } public static void main ( String [ ] args ) { float r = 4 , h = 8 ; System . out . println ( sph ( r , h ) ) ; } }