求各位大佬帮我看一下,为什么最后的if语句不对?
#include <stdio.h>#include <windows.h>
int main()
{
int mdays[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
int y,m,d,r=0,i,w,n;
printf("Input year month day:\n");
scanf("%d %d %d",&y,&m,&d);
if(y%400==0 || (y%4==0 && y %100 != 0))
mdays[1] = 29;
if(y<0 || m<=0 || m>12 || d<=0 || d>mdays[m-1])
{
printf("大宝贝儿,你输入年月日不对哦~\n");
return -1;
}
for(i = 0; i < m-1; i ++)
r+=mdays[i];
r+=d;
w=y-1+(y-1)/4-(y-1)/100+(y-1)/400+r;
n=w%7;
{
if(n=0)
printf("%d SUNDAY\n",r);
else
printf("%d %d\n",r,n);
}
return 0;
}