[MATLAB/Octave], 35 34 bytes
A=factorial(1:n) A(A<=n)(end) The second echo will return the result. Might crash your system for large values of n.
A=factorial(1:n) A(A<=n)(end) The second echo will return the result. Might crash your system for large values of n.