Practice>easy>obstacle_course (run time error) plz help

#include<stdio.h>
#include<math.h>
float dis(float,float,float,float);
int main()
{
int t;
scanf("%d",&t);
if(t>=1&&t<=25)
{
int n,i,j;
float r,R,k,d,f,d1,d2,ff;

for(i=1;i<=t;i++)                        
{

scanf("%f",&r);

scanf("%f",&R);                      
if(r>=1&&R>=1&&R<=25000&&r<R) 
	{
	
	scanf("%d",&n);
	if(n>0&&n<=500)
	{
	int arr1[n],arr2[n];
	float arr3[n];
	for(j=1;j<=n;j++)
	{
		
		scanf("%d%d",&arr1[j],&arr2[j]);
		if(arr1[j]!=arr2[j])
		{
		if(arr1[j]<0)
		{
			arr1[j]=arr1[j]*(-1);
			
		}
		if(arr2[j]<0)
		{
			arr2[j]=arr2[j]*(-1);
		}
        ff=sqrt(arr1[j]*arr1[j]+arr2[j]*arr2[j]);
		if(ff>=r&&ff<=R)			
	  {
	    f=dis(arr1[j],arr2[j],r,R);
		arr3[j]=f;
	   } 
	   else
	   {
	   	printf("the distance is %f which is not in range\n",ff);
	   	j--;
	   }
	}
	else 
	{
		j--;
		printf("coordinates are not alright\n");
	}
	}


	for(j=2;j<=n;j++)
	{
	      k=arr3[1];
	      if(arr3[j]<arr3[1])
	      {
	      	arr3[1]=arr3[j];
	      	arr3[j]=k;
	      	
	      }
	}

  printf("%0.3f\n",arr3[1]);

}
else if(n==0)
{
printf("%0.3f\n",R-r);
}
}
else printf(“the radius not in range\n”);
}

}
else
{
printf(“the number of cases should not exceed 25\n”);
main();
}
}
float dis(float x,float y,float r,float R)
{
float z,d1,d2;
z=sqrt(xx+yy);
printf(“the distance of the obstacle from the origin is%f\n”,z);
d1=z-r;
d2=R-z;
if(d1>=d2)
return d1;
else
return d2;
}

You dont have to print anything like “enter the no.” :stuck_out_tongue:

just print no. nothing else :slight_smile:

There are many reasons for getting Run time error.
check this link
Redefine your logic to make sure that that its is free from infinite loops etc.
As one thing, You should follow the exact formats of input & output in order to get green tick mark :slight_smile: from the Judge.
so remove some of the unnecessary characters in your printf statements.
happy coding :slight_smile:

hey see i have redefined my logic as well as code…again i am getting run time erroe…although the program is working right on codeblocks

I have tried my level best…you can copy my code and try it on ur compiler…you will get the correct ans…plz help if u can…
thanks