can you check my cpp code?
I make a cpp code which finding trailing zeros of factorial. For example, 5! is 120. So, Result is 1. Also, 6! is 720. Result needs to be 1. But in my computer, I don't have compiler to launch this code. So, i can't convince that i make right code. If you not mind launching, plz compile this code and tell me what is error in my code. #include <iostream> using namespace std; int main() { int n; //number of factorial seed cout<<"type number"<<endl; cin>>n; int x[n]; // make n array int m5[n]; // make n array of quotient devided by 5 int m2[n]; // make n array of quotient devided by 2 int counter=0; //component of m5 array int counter1=0; //component of m2 array int r=0; int sum=0; int sum1=0; for(int i=0;i<500;i++){ x[i]=i+1; r=i+1; while(r%5==0){ counter++; } while(r%2==0){ counter1++ } m5[i]=counter; m2[i]=counter1; } for(int j=0;j<n;j++){ sum+=m5[j]; //sum of component in m5 array sum1+=m2[j]; //sum of component in m2 array } if(sum<sum1){ cout<<"number of trailing zero is"<<sum<<endl;} else{ cout<<"number of trailing zero is"<<sum1<<endl; } return 0; }