So the code runs fine on my computer, however when I submit it I get a wrong answer. Could anyone point out where I’m making a mistake.
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(0);
int count, temp, num, t_cases = 0;
int i = 0;
cin >> t_cases;
while (t_cases--)
{
cin >> num;
while (i <= num)
{
temp = i;
while (temp > 0 && temp % 5 == 0)
{
temp = temp / 5;
count++;
}
i += 5;
}
cout << count << endl;
}
return 0;
}
6
3
60
100
1024
23456
8735373
0
14
24
253
5861
2183837
I’m getting an output wrong message.