Program to check if N is a Hexadecagonal Number | Java program for the above approach ; Function to check if N is a hexadecagonal number ; Condition to check if the number is a hexadecagonal number ; Driver code ; Given number ; Function call
import java . lang . Math ; class GFG { public static boolean ishexadecagonal ( int N ) { double n = ( 12 + Math . sqrt ( 112 * N + 144 ) ) / 28 ; return ( n - ( int ) n ) == 0 ; } public static void main ( String [ ] args ) { int N = 16 ; if ( ishexadecagonal ( N ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }