Find bug in my code

#include <stdio.h>
void main(void)
{ int n,a[1000],i,j,temp;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0; i<n; i++)
{ for(j=i+1; j<n; j++)
{ if(a[i]>a[j])
{ temp=a[i];
a[i]=a[j];
a[j]=temp;}
}
}
for(i=0;i<n;i++){ printf("\n%d\n",a[i]);}
}

THEY TELL RUN TIME ERROR BUT I CAN’T FIND!

check the constraint for array a, it might be bigger than 1000. And also please attach the question for better understanding.

1 Like

Please check your input of n must be greater than 1000 because of which it is showing run time error.

Can you please paste the question as well?