Program to check if N is a Nonagonal Number | C # program for the above approach ; Function to check if N is a nonagonal number ; Condition to check if the number is a nonagonal number ; Driver code ; Given number ; Function call
using System ; class GFG { public static bool isnonagonal ( int N ) { double n = ( 5 + Math . Sqrt ( 56 * N + 25 ) ) / 14 ; return ( n - ( int ) n ) == 0 ; } public static void Main ( string [ ] args ) { int N = 9 ; if ( isnonagonal ( N ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }