text: Check if a given number is factorial of any number | Function to check if the given number is a factorial of any number ; Driver Code
code: function isFactorial ( n ) { for ( var i = 1 ; ; i ++ ) { if ( n % i == 0 ) { n = parseInt ( n / i ) ; } else { break ; } } if ( n == 1 ) { return true ; } else { return false ; } } var n = 24 ; var ans = isFactorial ( n ) ; if ( ans == 1 ) { document . write ( " " ) ; } else { document . write ( " " ) ; }