factorial trailing zeroes

using namespace std;

int main(){
int n;
int *p=new int;
for(int i=0;i<n;i++){
for(int i=0;i<n;i++){

int c=0;//count initialized
for(int j=5;p[i]/j>=1;j*=5){
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.