This is my solution for the Factorial problem under the Practice < Easy section.
I’m getting wrong answer when i submit.
long int fact (long int);
int main ()
long int t;
long int i;
long int arr[t];
long int fact (long int x)
long int i=1,term;
long int sum=0;
Your code gives Wrong Output for:
How should I fix this ?
And how did you figure this thing out that I’m getting wrong output for this specific input ?
(sorry I’m new here)
I have tested some test cases against your code and my AC’ed code, and so i got the test case for which your code failed
See this was my logic:
val =((num/5) + (num/25) + (num/125) + (num/625) + (num/3125) + (num/15625) + (num/78125) + (num/390625) + (num/1953125) + (num/9765625) + (num/48828125) + (num/244140625) + (num/1220703125) );
I computed all 5^i according to constraints and solved the problem.