满意答案
pu1hs4fq7a
2014.02.05
采纳率:55% 等级:11
已帮助:9988人
#define N 4
#include
#include
main()
{ int x,y=1,t,w=1;
int k,sum=0,a[N];
scanf("%d",&k);
while (k%4==0&&k%100!=0||k%400==0)
{printf("input eror ,input again:\n"); scanf("%d",&k); }
for(x=1;x
{if(x%4==0&&x%100!=0||x%400==0)w+=366;else w+=365; w=w%7;}
w=(w+12)%7;if(w==3) {sum++;a[sum]=y;}
while(y<12)
{ switch(y)
{
case 1:case 3:case 5:case 7:case 8:case 10:t=31;break;
case 4:case 6: case 9: case 11:t=30;break;
case 2:t=28;break;
}
y++;w=(w+t)%7;if(w==3) {sum++;a[sum]=y;}
}
if(sum!=1)
printf(" There are %d days , They are:\n",sum,k);
else printf("There is only 1 day, It is:\n");
for(t=1;t<=sum;t++)printf("%d年%d月13日 星期三\n",k,a[t]);
system("pause");
}
编了好长时间啊,看看行吗?
00分享举报