FACT25- CODE ERA

I used the code CodeChef: Practical coding for everyone to solve the question CodeChef: Practical coding for everyone . My code got accepted, but in my machine, it is showing 0 if the input number is greater than 20. Please tell me why is it happening??

the test cases for the problem must be weak!