Distance between Incenter and Circumcenter of a triangle using Inradius and Circumradius | Java program for the above approach ; Function returns the required distance ; Driver code ; Length of Inradius ; Length of Circumradius
import java . util . * ; class GFG { static double distance ( int r , int R ) { double d = Math . sqrt ( Math . pow ( R , 2 ) - ( 2 * r * R ) ) ; return d ; } public static void main ( String [ ] args ) { int r = 2 ; int R = 5 ; System . out . println ( Math . round ( distance ( r , R ) * 100.0 ) / 100.0 ) ; } }