# include & lt; stdio.h>
Int main ()
{
Int year, t, s, day;
The scanf (" % d ", & amp; Year);
T=(year 1)/4;
S=(year 1) % 4;
The switch (s)
{
Case: 0 day=t * (365 * 3 + 366); break;
Case 1: day=t + 365 * (365 * 3 + 366); break;
Case 2: day (365 * 3 + 366)=t * 365 * 2 +; break;
Case 3: day (365 * 3 + 366)=t * 365 * 3 +; break;
}
int i;
I=day % 7;
The switch (I)
{
Case 0: printf (" Monday \ n "); break;
Case 1: printf (" Tuesday \ n "); break;
Case 2: printf (" Wednesday \ n "); break;
Case 3: printf (" Thursday \ n "); break;
Case 4: printf (" Friday \ n "); break;
Case 5: printf (" Saturday \ n "); break;
Case 6: printf (" Sunday \ n "); break;
}
return 0;
}
CodePudding user response:
Have a test case? Hair, don't know where you're wrong is to test error, or other errors?CodePudding user response:
# include & lt; stdio.h>
Int main ()
{
Int year, t, s, day;
The scanf (" % d ", & amp; Year);
T=(year 1)/4;
S=(year 1) % 4;
The switch (s)
{
Case: 0 day=t * (365 * 3 + 366); break;
Case 1: day=t + 365 * (365 * 3 + 366); break;
Case 2: day (365 * 3 + 366)=t * 365 * 2 +; break;
Case 3: day (365 * 3 + 366)=t * 365 * 3 +; break;
}
int i;
I=day % 7;
The switch (I)
{
Case 0: printf (" Sunday \ n "); break;
Case 1: printf (" Monday \ n "); break;
Case 2: printf (" Tuesday \ n "); break;
Case 3: printf (" Wednesday \ n "); break;
Case 4: printf (" Thursday \ n "); break;
Case 5: printf (" Friday \ n "); break;
Case 6: printf (" Saturday \ n "); break;
}
return 0;
}
For your reference ~
Case 0 to Sunday, followed by modifying the value corresponding to the week I can ~
Don't case0 is 7 0 7%? How to change the 0 to Monday?
CodePudding user response:
You don't say, four leap best don't leap, four hundred leap, you put 100200300500600,,,, these give a leap year, again the results have a problem for certain