Find all factorial numbers less than or equal to n | CPP program to find all factorial numbers smaller than or equal to n . ; Compute next factorial using previous ; Driver code
#include <iostream> NEW_LINE using namespace std ; void printFactorialNums ( int n ) { int fact = 1 ; int x = 2 ; while ( fact <= n ) { cout << fact << " ▁ " ; fact = fact * x ; x ++ ; } } int main ( ) { int n = 100 ; printFactorialNums ( n ) ; return 0 ; }