Program to check if N is a Octagonal Number | Function to check if N is a Octagonal Number ; Condition to check if the number is a octagonal number ; Given Number ; Function call
function isoctagonal ( N ) { var n = ( 2 + Math . sqrt ( 12 * N + 4 ) ) / 6 ; return ( n - parseInt ( n ) == 0 ) ; } var N = 8 ; if ( isoctagonal ( N ) ) { document . write ( " " ) ; } else { document . write ( " " ) ; }