Why am I getting wrong answer in small factorial problem despite it works perfect on my computer?Java code is below...

here

You should try using long variables. By using int variables you will only be able to get until 13! because they are really big numbers.

Recommendation: Do not suppose that your code is correct because it works for the example cases. The testers test a wide range of cases that maybe you didn’t take into account.