text: Find number of diagonals in n sided convex polygon | PHP function to find number of diagonals in n sided convex polygon ; Driver Code
code: < ? php function numberOfDiagonals ( $ n ) { return $ n * ( $ n - 3 ) / 2 ; } $ n = 5 ; echo $ n , " ▁ sided ▁ convex ▁ polygon ▁ have ▁ " ; echo numberOfDiagonals ( $ n ) , " ▁ diagonals " ;