文章
28
粉丝
230
获赞
23
访问
242.0k
#include <stdio.h>
#include <stdlib.h>
int Month[]={18,31,30,31,31,30,31,30,31};
//int data[]={6,7,1,2,3,4,5};
int main(int argc, char const *argv[])
{
int i,DAY,month,day,key ;//DAY表示已经相较于4月12日过去了DAY天
DAY=i=0;
scanf("%d",&month);
scanf("%d",&day);
key=month ;
while(month - 4 != 0){
DAY += Month[i];
i++;
month--;
}if(key == 4){
DAY = day-12;
}else{
DAY += day ;
}
switch(DAY%7){//如果你需要往后数DAY%7天的话,对应的日期为:
case 4 : printf("Monday");break;
case 5 : printf("Tuesday");break;
case 6 : printf("Wednesday");break;
case 0 : printf("Thursday");break;
case 1 : printf("Friday");break;
case 2 : printf("Saturday ");break;
case 3 : printf("Sunday");break;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发