Area of decagon inscribed within the circle | C ++ Program to find the area of the decagon inscribed within a circle ; Function to find the area of the decagon ; radius cannot be negative ; area of the decagon ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float area ( float r ) { if ( r < 0 ) return -1 ; float area = ( 5 * pow ( r , 2 ) * ( 3 - sqrt ( 5 ) ) * ( sqrt ( 5 ) + ( 2 * sqrt ( 5 ) ) ) ) / 4 ; return area ; } int main ( ) { float r = 8 ; cout << area ( r ) << endl ; return 0 ; }