code execution

I was solving a problem (DDISH http://www.codechef.com/problems/DDISH)when i found this error .
the execution wasn’t traversing the whole code .
I will be really grateful if someone could point out why .
it only prints loop 1 then loop 3.

#include<stdio.h>
void main()
{
int t,l,r,i,j,d,c,p;int a[10];       //declaring some variables
scanf("%d",&t);
scanf("\n");
 
	while(t!=0)
	{	 
	
		p=0;printf("inside while loop 1 \n");           //initializing p(counter to check no. of dishes)
		
		
		for(j=0;j<10;j++)          //initializing an array a which counts the no. of digits repeated
		{
			a[j]=0;
		}
		
		
		scanf("%d %d",&l,&r);
	forloop:	for(i=r;i<=l;i++)    //extracting all nos. between r and l
		{			
			c=i;printf("inside for loop \n");
			
			for(j=0;j<10;j++)    //again initializing a[]
			{
			a[j]=0;
			}
			
			
			while(c!=0)    //checking each digit
			{
				d=c%10;printf("inside while loop 2 \n");
				a[d]++;     //increasing the value by one, corresponding to the digit 
				c=c/10;
			}
			
			
				if((a[0]>1)||(a[1]>1)||(a[2]>1)||(a[3]>1)||(a[4]>1)||(a[5]>1)||(a[6]>1)||(a[7]>1)||(a[8]>1)||(a[9]>1))    //condition for digits to be repeated
				{goto forloop;printf("inside if \n");}
 
			
				else
				{p++;printf("inside else \n");}
		}
			t--;printf("inside while loop 3 \n");
			printf("%d",p);   //printing the answer
	}
}

Its always good to provide the link of the question and put your logic in words before the code.

ok thnks i’ll try