请高手看一下错在哪里?
输入年,月,日,;输出星期几#include <stdio.h>
main()
{
int y,m,d,w;
scanf("%d%d%d",&y,&m,&d);
if((y%4==0&&y%100!=0)||y%400==0)
{
switch(m)
{
case 1:w=(365*y+(y/4-y/100+y/400)+d-2)%7;break;
case 2:w=(365*y+(y/4-y/100+y/400)+d+29)%7;break;
case 3:w=(365*y+(y/4-y/100+y/400)+d+58)%7;break;
case 4:w=(365*y+(y/4-y/100+y/400)+d+89)%7;break;
case 5:w=(365*y+(y/4-y/100+y/400)+d+119)%7;break;
case 6:w=(365*y+(y/4-y/100+y/400)+d+150)%7;break;
case 7:w=(365*y+(y/4-y/100+y/400)+d+180)%7;break;
case 8:w=(365*y+(y/4-y/100+y/400)+d+211)%7;break;
case 9:w=(365*y+(y/4-y/100+y/400)+d+242)%7;break;
case 10:w=(365*y+(y/4-y/100+y/400)+d+272)%7;break;
case 11:w=(365*y+(y/4-y/100+y/400)+d+303)%7;break;
case 12:w=(365*y+(y/4-y/100+y/400)+d+333)%7;
}
}
else
{
switch(m)
{
case 1:w=(365*y+(y/4-y/100+y/400)+d-1)%7;break;
case 2:w=(365*y+(y/4-y/100+y/400)+d+30)%7;break;
case 3:w=(365*y+(y/4-y/100+y/400)+d+58)%7;break;
case 4:w=(365*y+(y/4-y/100+y/400)+d+89)%7;break;
case 5:w=(365*y+(y/4-y/100+y/400)+d+119)%7;break;
case 6:w=(365*y+(y/4-y/100+y/400)+d+150)%7;break;
case 7:w=(365*y+(y/4-y/100+y/400)+d+180)%7;break;
case 8:w=(365*y+(y/4-y/100+y/400)+d+211)%7;break;
case 9:w=(365*y+(y/4-y/100+y/400)+d+242)%7;break;
case 10:w=(365*y+(y/4-y/100+y/400)+d+272)%7;break;
case 11:w=(365*y+(y/4-y/100+y/400)+d+303)%7;break;
case 12:w=(365*y+(y/4-y/100+y/400)+d+333)%7;
}
}
switch(w)
{
case 1:printf("1\n");break;
case 2:printf("2\n");break;
case 3:printf("3\n");break;
case 4:printf("4\n");break;
case 5:printf("5\n");break;
case 6:printf("6\n");break;
case 0:printf("7\n");
}
}