factorial trailing zeroes

#include
using namespace std;

int main(){
int n;
cin>>n;
int *p=new int;
for(int i=0;i<n;i++){
cin>>p[i];
}
for(int i=0;i<n;i++){

int c=0;//count initialized
for(int j=5;p[i]/j>=1;j*=5){
c+=p[i]/j;
}
cout<<c<<endl;
}
return 0;

}
// the code is showing runtime error. why? how to get rid of it?

You are getting RTE because of this line of yours:

int *p=new int

The lines says that, p is a pointer to an integer, you need to have a pointer to a block of integer i.e.

int *p= new int[n];

Pointer to n blocks allocated on the heap.