# Anyone help where my code is wrong(Gregorian Calendar Problem Code: FLOW015)

int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin>>t;
while(t–)
{
int n;
cin>>n;
if(n<2001)
{
int k=1;
for(int i=2000;i>=n;i–)
{ if (((i % 4 == 0) && (i % 100 != 0)) || (i % 400 == 0))
{if(k==1 && i==n)
{
continue;
}
else if(k==1 && i!=n)
{
k=6;
}
else if(k==2 && i==n)
{
continue;
}
else if(k==2 && i!=n)
{
k=7;
}
else
{
k=k-2;
}

``````             }
else
{
if(k==1 && i==n)
{
continue;
}
else if(k==1 && i!=n)
{
k=7;
}
else
{
k--;
}

}
}
if(k==1)
{
cout<<"monday"<<"\n";
}
else if(k==2)
{
cout<<"tuesday"<<"\n";
}
else if(k==3)
{
cout<<"wednesday"<<"\n";
}
else if(k==4)
{
cout<<"thursday"<<"\n";
}
else if(k==5)
{
cout<<"friday"<<"\n";
}
else if(k==6)
{
cout<<"saturday"<<"\n";
}
else if(k==7)
{
cout<<"sunday"<<"\n";
}

}
else
{  int k=1,check=0;
if(n==2001)
{
cout<<"monday"<<"\n";
break;
}
for(int i=2002;i<=n;i++)
{
if (((i % 4 == 0) && (i % 100 != 0)) || (i % 400 == 0))
``````

{
if(k==7 && i==n)
{
continue;
}
else if(k==7 && i!=n)
{
k=1;
check=1;
}
else
{
k++;
check=1;
}
}
else
{
if(check==1 && k==7 && i==n)
{
continue;
check=0;
}
else if(check==1 && k==7 && i!=n)
{
k=2;
check=0;
}
else if(check==0 && k==7 && i==n)
{
continue;
}
else if(check==0 && k==7 && i!=n)
{
k=1;
}
else if(check==1 && k==6 && i==n)
{
continue;
check=0;
}
else if(check==1 && k==6 && i!=n)
{
k=1;
check=0;
}
else if(check==0 && k==6 && i==n)
{
continue;
}
else if(check==0 && k==6 && i!=n)
{
k++;
}
else if(check==1)
{
k=k+2;
check=0;
}
else
{
k++;
check=0;
}
}
}

``````        if(k==1)
{
cout<<"monday"<<"\n";
}
else if(k==2)
{
cout<<"tuesday"<<"\n";
}
else if(k==3)
{
cout<<"wednesday"<<"\n";
}
else if(k==4)
{
cout<<"thursday"<<"\n";
}
else if(k==5)
{
cout<<"friday"<<"\n";
}
else if(k==6)
{
cout<<"saturday"<<"\n";
}
else if(k==7)
{
cout<<"sunday"<<"\n";
}
}
}
return 0;
``````

}