text: Check if a given number is factorial of any number | C # implementation for the above approach ; Function to check if the given number is a factorial of any number ; Driver Code
code: using System ; class GFG { static Boolean isFactorial ( int n ) { for ( int i = 1 ; ; i ++ ) { if ( n % i == 0 ) { n /= i ; } else { break ; } } if ( n == 1 ) { return true ; } else { return false ; } } public static void Main ( String [ ] args ) { int n = 24 ; Boolean ans = isFactorial ( n ) ; if ( ans == true ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }