This is the first time I’m solving a problem on codechef.

I was solving FCTRL problem where you need to return trailing zeros. Following is my approach. Though I was getting expected output on submission it says wrong answer. Please tell me what’s wrong with this code.

#include

#include <math.h>

using namespace std;

int trailing_zeros(int n){

int temp=n, result=0, i=1;

while(pow(5, i)<n){

result= result+(n/pow(5, i));

i++;

}

return result;

}

int main() {

int T, N;

cin>>T;

for(int t=T; t>0; t–){

cin>>N;

cout<<trailing_zeros(N)<<endl;

}

return 0;

}