wrong answer but right output ? Rainbow problem

#include<stdio.h>
int func(int [],int);
int n;
int main()
{
int cas,n,a[100],yes[100],i,j;
scanf("%d",&cas);
if(cas<1||cas>100)
goto x;
for(i=0;i<cas;i+=1)
{
scanf("%d",&n);

  for(j=0;j<n;j++)
  {
   scanf("%d",&a[j]); 
   
   
  }
  yes[i]=func(a,n-1);
  
 }
 int g;
 for(g=0;g<cas;g++)
  {
    if(yes[g]==1)
       printf("yes\n");
    else
    if(yes[g]==0)
       printf("no\n");
  }
  x:
 return 0;
}

int func(int a[],int n)
{
 int i,j;
 for(i=0,j=n;i<j;i++,j--)
 {
  if(a[i]!=a[j])
  return 0;
  else if(a[i+1]-a[i]>1)
  return 0;
  else if(a[i]<0)
  return 0;
  else if(a[i+1]=a[i]<0)
  return 0;
  else if(a[1]<1||a[i]>7)
  return 0;
 }
 return 1;
}
else if(a[i+1]=a[i]<0)

This seems wrong.

Also, where are you checking that the array has only elements in range [1,7]? If it ahs 8,9, or 10 then array isnt a rainbow array.

//