HELP! WITH GREGORIAN CALENDER PROBLEM

the question is to find what was the day on first january of the year;
my output is correct but i don’t understand why my algo is going wrong
if anyone could clear my doubt please.
does codechef consider a particular algo.
the code of mine is given below.

#include <stdio.h>

int main()
{
int a,year1,year,x,y,z,s;
scanf("%d",&a);
for(int i=0;i<a;i++)
{scanf("%d",&year);

``````year1=year-1;
x=year1%7;
y=year1/4;
z=y%7;
s=x+z;
if(s==12)
printf("friday\n");
else if(s==11)
printf("thursday\n");
else if(s==10)
printf("wednesday\n");
else if(s==9)
printf("tuesday\n");
else if (s==8)
printf("monday\n");
else if(s==7)
printf("sunday\n");
else if (s==6)
printf("saturday\n");
else if (s==5)
printf("friday\n");
else if (s==4)
printf("thursday\n");
else if(s==3)
printf("wednesday\n");
else if(s==2)
printf("tuesday\n");
else if(s==1)
printf("monday\n");
}
return 0;
``````

}

1 Like

You should include the link to the problem also.

Never mind, you didn’t consider the test cases.

For input:
1
1900
Output should be:
monday