A number N is called a factorial number if it is the factorial of a positive integer. For example, the first few factorial numbers are 1, 2, 6, 24, 120, …
Given a number N, the task is to print all factorial numbers smaller than or equal to N.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains a number N as input.
For each test case, print all factorial numbers smaller than or equal to N in new line.
1 2 6
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.