发布网友 发布时间:2024-08-18 22:28
共1个回答
热心网友 时间:2024-08-29 10:04
#include<stdio.h>
int main()
{int m,d,w,i;
char week[7][4]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
scanf("%d%d",&m,&d);
w=d-1;
for(i=1;i<m;i++)
switch(i)
{case 1:case 3:case 5: case 7:case 8:case 10: w+=31; break;
case 4: case 6:case 9:case 11:w+=30; break;
case 2:w+=28;
}
w%=7;
printf("2017-%d-%d is %s.\n",m,d,week[w]); //0表示星期天
return 0;
}