What is wrong in this code? Chef and RAinbow Array

#include <stdio.h>

int main()
{
int t;
//printf(“Enter no of Test Cases: “);
scanf(”%d”,&t);

while(t–)
{

    int n,i,j,c=0;
  //  printf("Enter Array Size:");
    scanf("%d",&n);
    int a[n];
//    printf("\nEnter array elements");
   
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);   
   
    for(i=0,j=n-1;i<n/2,j>n/2;--j,++i)
    {
       
        if(a[i]<1 || a[j]>7 || a[n/2]<1 || a[n/2]>7)
       {
            c=1;
           printf("no\n");
           break;
       }
       
       if(a[i]!=a[j] || a[i]>a[i+1] || a[j]>a[j-1])
       {
          // printf("Error");
           c=1;
           printf("no\n");
           break;
       }
       if(a[i+1]-a[i]!=0 && a[i+1]-a[i]!=1)
       {
            c=1;
           printf("no\n");
           break;
       }
       if(a[j-1]-a[j]!=0 && a[j-1]-a[j]!=1)
       {
            c=1;
           printf("no\n");
           break;
       }
       
    }
   if(c==0)
    printf("yes\n");

}

return 0;

}

Firstly, print “yes” and “no” instead of “YES” and “NO”. The case matters.

Then, where are you making sure that all elements in array are in range [1,7]??

There-

Input
1
11
2 3 4 5 6 7 6 5 4 3 2
Your Output
yes
Expected Output
no
Jury's Verdict
Expected 'no' found 'yes'. Wrong Answer. 
Comments
Rainbow array MUST start with 1.

no, i haven’t checked for any kind of range

just added constraints like

1235321 is not a rainbow array! since 4 is missing

A rainbow array elements in range [1,7] only. Any other element=array not rainbow.

Eg-

[0,1,2,3,4,5,6,7,6,5,4,3,2,1,0] is not a rainbow but [1,2,3,4,5,6,7,6,5,4,3,2,1] is rainbow.

fixed it
yet not correct

Link to updated code please.

https://www.codechef.com/viewsolution/15411405

@charvi87 your code is still printing “yes” for the above test case provided by vijju