Program to check if N is a Chiliagon Number | Java program for the above approach ; Function to check that if N is Chiliagon Number or not ; Condition to check if N is a Chiliagon Number ; Driver Code ; Given Number ; Function call
class GFG { static boolean is_Chiliagon ( int N ) { float n = ( float ) ( 996 + Math . sqrt ( 7984 * N + 992016 ) ) / 1996 ; return ( n - ( int ) n ) == 0 ; } public static void main ( String s [ ] ) { int N = 1000 ; if ( is_Chiliagon ( N ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }