Welcome to the forum!
Please note that I have added code tags to your post, whenever you post code, please use them.
As for your question, make sure that you read the problem statement in it's entirety and note all of the details.
int only holds values less than 2^31. 10^10000 is much larger than that. You will need to find a more creative solution to this problem. This is a much more advanced problem than the factorial problem that you are also working on.