View Code of Problem 6

# include<stdio.h>
int main(void)
{
  int t,n;
  int count = 0;
  int c[50000] = {};
  scanf("%d",&t);
  int a[50000] = {};
  int b[50000] = {};
  while(count<t)
  {
    scanf("%d",&n);
    for(i=0;i<n;++i)
    {
      scanf("%d",&a[i]);
      scanf(" %d\n",&b[i]);
    }
    for(i=0;i<n;;++i)
    {
      if(b[i]-a[i]>1)
      {
        c[i] = "NO";
        break;
      }
      if(i==n-1&&b[i]-a[i]=1)
      {
        c[i] = "YES";
      }
    }
    ++count;
  }
  return 0;
 }
/*
Main.c: In function 'main':
Main.c:13:9: error: 'i' undeclared (first use in this function)
     for(i=0;i<n;++i)
         ^
Main.c:13:9: note: each undeclared identifier is reported only once for each function it appears in
Main.c:18:17: error: expected expression before ';' token
     for(i=0;i<n;;++i)
                 ^
Main.c:9:7: warning: variable 'b' set but not used [-Wunused-but-set-variable]
   int b[50000] = {};
       ^
Main.c:8:7: warning: variable 'a' set but not used [-Wunused-but-set-variable]
   int a[50000] = {};
       ^
Main.c:6:7: warning: variable 'c' set but not used [-Wunused-but-set-variable]
   int c[50000] = {};
       ^
*/

Double click to view unformatted code.


Back to problem 6