getting WA,plz check the code

problem:http://www.codechef.com/problems/RECIPE
my solution:http://www.codechef.com/viewsolution/4163741

You are supposed to find the gcd of the numbers entered in one test case.
Your logic is correct, there’s just a very little mistake.

Just assign st=0 as given below in the loop of the variable i:

    for(j=x;j>0;j--)
	{
	        st=0;
                    
		for(i=0;i<n;i++)
		{
			if(a[i]%j==0)
			st=st+1;
			if(st==n)
			y=1;
			}
			if(y==1)
			break;
	}

Here’s the link to my submissions of this question, http://www.codechef.com/status/RECIPE,pratku123

If you still have any problem you can comment below.

//