Factorial Problem doubt

cant figure out why test cases are going wrong

use unsigned long long int everywhere, there might be some cases where ans of largestprime don’t get stored in long long. I had made few changes in your code and it works fine now.
please check here https://ide.codingblocks.com/s/222706