What error are you getting by this code??
The problem with your code is that you are trying to store a number which is out of the range of int. It wouldn’t have mattered even if you would have used long long because range of long long is roughly 10^19(approx 20 digits) and 100! itself has 21 zeroes at the end. So in long long you can only store upto 20! or 21!.This is why your code is wrong, assuming you have to calculate factorial of numbers greater than 20 or 21.
Your code is right but you see factorials of a number is very large int can’t store above factorial of 20( that too i doubt) even long long or unsigned 64-bit integer can’t store value of 100!(unsigned 64-bit integer can store value upto 19 digits whereas 100! is 150+ digits)you need to be cleverer here see this has the solution http://iamit.in/blog/Spoj-Problem-Small-Factorials-FCTRL2-Explanation-and-Solution/