text: Megagon number | C # program for the above approach ; Function to find the nth Megagon Number ; Driver code
code: using System ; class GFG { static int MegagonNum ( int n ) { return ( 999998 * n * n - 999996 * n ) / 2 ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . Write ( MegagonNum ( n ) ) ; } }