#include<stdio.h>
int second(int year, int month, int days)
{
static int mdays[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30 };
int i, y = year - 1;
for (i=0; i<month; ++i) days += mdays[i];
if (month>2)
{
if (((year%400)==0) || ((year&3)==0 && (year%100))) ++days;
}
return (y+y/4-y/100+y/400+days)%7;
}
void secondproblem()
{
int year,month,day,w;
static char* wday[]={ "æ¥","ä¸","äº","ä¸","å","äº","å
" };
printf("请è¾å
¥å¹´ä»½ï¼\n");
scanf("%d",&year);
printf("请è¾å
¥æ份ï¼\n");
scanf("%d",&month );
printf("请è¾å
¥æ¥æï¼\n");
scanf("%d",&day);
w = second(year,month,day);
printf("%då¹´%dæ%dæ¥ æ¯ææ%s.\n\n", year, month, day, wday[w]);
}
int main()
{
secondproblem();
return 0;
}
温馨提示:答案为网友推荐,仅供参考