Find all factorial numbers less than or equal to n | Java program to find all factorial numbers smaller than or equal to n . ; Compute next factorial using previous ; Driver code
class GFG { static void printFactorialNums ( int n ) { int fact = 1 ; int x = 2 ; while ( fact <= n ) { System . out . print ( fact + " ▁ " ) ; fact = fact * x ; x ++ ; } } public static void main ( String [ ] args ) { int n = 100 ; printFactorialNums ( n ) ; } }