13课前两题。

This commit is contained in:
unlockable
2022-12-19 19:28:38 +08:00
parent b3c8b046f7
commit 095a451c13
3 changed files with 167 additions and 0 deletions

38
13/Exercise02.c Normal file
View File

@@ -0,0 +1,38 @@
#include <stdio.h>
#include <string.h>
enum weekday {sun, mon, tue, wed, thu, fri, sat};
int main() {
int input = 0;
char output[10];
scanf("%d", &input);
switch (input % 7)
{
case sun:
strcpy(output, "Sunday");
break;
case mon:
strcpy(output, "Monday");
break;
case tue:
strcpy(output, "Tuesday");
break;
case wed:
strcpy(output, "Wednesday");
break;
case thu:
strcpy(output, "Thursday");
break;
case fri:
strcpy(output, "Friday");
break;
case sat:
strcpy(output, "Saturday");
break;
default:
break;
}
printf("%s", output);
return 0;
}