text: Find number of diagonals in n sided convex polygon | C # function to find number of diagonals in n sided convex polygon ; driver code to test above function
code: using System ; class GFG { static int numberOfDiagonals ( int n ) { return n * ( n - 3 ) / 2 ; } public static void Main ( ) { int n = 5 ; Console . Write ( n + " ▁ sided ▁ convex ▁ polygon ▁ have ▁ " ) ; Console . WriteLine ( numberOfDiagonals ( n ) + " ▁ diagonals " ) ; } }