Program to check if N is a Octadecagon number | Java program for the above approach ; Function to check if N is a octadecagon Number ; Condition to check if the number is a octadecagon number ; Driver Code ; Given Number ; Function call
import java . lang . Math ; class GFG { public static boolean isOctadecagon ( int N ) { double n = ( 14 + Math . sqrt ( 128 * N + 196 ) ) / 32 ; return ( n - ( int ) n ) == 0 ; } public static void main ( String [ ] args ) { int N = 18 ; if ( isOctadecagon ( N ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }