Factorial program

I am trying to calculate a factorial of a number but not getting answer. CAN you please explain where am I going wrong??

Hello @div_yanshu07 what methos you are using in this?
you have to use array here to store your answers because the constraints are high.

Yeah, I have stored in array only but I want to convert that array into a number. How can I perform that??
Even if it doesn’t store all the digits it’s fine

@div_yanshu07 share your code i will see it.

Even If I use stoll for conversion into string it gives out of range

@div_yanshu07 i have corrected your code:


you cant store the result in any number even if you define the number as long long int because long long int can handle digits upto 1e18 only whereas accordinf to the constraints factorial of 500 is of length 158 digits.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.