Broken Calculator

When applying factorial on the number . It comes out of range even applying long long int.
what approach should I apply?

Factorial of big numbers say 50 cannot be stored in any data type. Even long long int cannot support that because Factorial of 50 is 30414093201713378043612608166064768844377641568960512000000000000 which is greater that 10^16. So simple approach of finding factorial will not work here as you cannot store such large number. So instead you should maintain an array to store each digit of such large number.
Refer this article:

Please Check which test case I am failing https://ide.codingblocks.com/s/208529

Segmentation fault is due to line 18…size cannot be taken as INT_MAX…change that line to int res[100000];
and then proceed.