Find the first natural number whose factorial is divisible by x | A simple C # program to find first natural number whose factorial divides x ; Returns first number whose factorial divides x . ; int i = 1 ; Result ; Driver code
using System ; class GFG { static int firstFactorialDivisibleNumber ( int x ) { int fact = 1 ; for ( i = 1 ; i < x ; i ++ ) { fact = fact * i ; if ( fact % x == 0 ) break ; } return i ; } public static void Main ( ) { int x = 16 ; Console . Write ( firstFactorialDivisibleNumber ( x ) ) ; } }