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