Read a number n from the input and find n! The number of zeros at the end.
Input format:
There are several lines of input. There is an integer m on the first line, indicating the number of digits that follow. Then there are m rows, each row contains a certain positive integer n, 1<=n<=1000000000.
Output format:
For each data n in the input line, output one line, and its content is n! The number of zeros at the end.
Input example:
3
3
100
1024
Output example:
0
24
253 The
easy-to-know factor 5 is less than 2, and some of the factors of 5 are divided by 5 more than once
#include<bits/stdc++.h>
using namespace std;
int main(){
int m;
cin>>m;
while(m--){
int x,t5=5,sum=0;
cin>>x;
while(t5<=x){
sum+=x/t5;t5*=5;
}
cout<< sum<<endl;
}
return 0;
}