+ Start a Discussion
mydhili pmydhili p 

hi, i want to find out the radius of a cylinder. for that how to write the formula [r=sqrt(7*v)/(22*h)]. how to write this in ape method?

ayu sharma devayu sharma dev
Hello,

If you want a separate method for the formula you can following code:
public static decimal getRadius( decimal volume, decimal height ){
	decimal pi = 3.47;
	return Math.sqrt( volume/( pi * height ) );
}

Or if you want to add a piece of code in the existing method then add below lines:
 
Decimal pi = 3.47;
Decimal radius = Math.sqrt( volume/( pi * height ) );

Let me know if it works and if it works then mark the question Solved.

Regards
Ayush Sharma