Calculate the factorial for a user-defined number.