Program to check if N is a Centered Pentagonal Number or not | C # program for the above approach ; Function to check if number N is a centered pentagonal number ; Condition to check if N is a centered pentagonal number ; Driver Code ; Given number ; Function call
using System ; class GFG { static bool isCenteredpentagonal ( int N ) { float n = ( float ) ( ( 5 + Math . Sqrt ( 40 * N - 15 ) ) / 10 ) ; return ( n - ( int ) n ) == 0 ; } public static void Main ( string [ ] args ) { int N = 6 ; if ( isCenteredpentagonal ( N ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }