text: Area of a n | C # Program to find the area of a regular polygon with given radius ; Function to find the area of a regular polygon ; Side and radius cannot be negative ; Area degree converted to radians ; Driver code
code: using System ; class GFG { static double polyarea ( double n , double r ) { if ( r < 0 && n < 0 ) return - 1 ; double A = ( ( r * r * n ) * Math . Sin ( ( 360 / n ) * 3.14159 / 180 ) ) / 2 ; return A ; } public static void Main ( ) { float r = 9 , n = 6 ; Console . WriteLine ( polyarea ( n , r ) ) ; } }