Descartes ' Circle Theorem with implementation | C ++ implementation of the above formulae ; Function to find the fourth circle 's when three radius are given ; Driver code ; Radius of three circles ; Calculation of r4 using formula given above
#include <bits/stdc++.h> NEW_LINE using namespace std ; double findRadius ( double r1 , double r2 , double r3 ) { double r4 = ( r1 * r2 * r3 ) / ( r1 * r2 + r2 * r3 + r1 * r3 + 2.0 * sqrt ( r1 * r2 * r3 * ( r1 + r2 + r3 ) ) ) ; return r4 ; } int main ( ) { double r1 = 1 ; double r2 = 1 ; double r3 = 1 ; double r4 = findRadius ( r1 , r2 , r3 ) ; cout << " The ▁ radius ▁ of ▁ fourth ▁ circle : ▁ " << r4 ; return 0 ; }