text: Find number of diagonals in n sided convex polygon | Javascript function to find number of diagonals in n sided convex polygon ; Driver code
code: function numberOfDiagonals ( n ) { return n * ( n - 3 ) / 2 ; } var n = 5 ; document . write ( n + " " ) ; document . write ( numberOfDiagonals ( n ) + " " ) ;