编写程序,从键盘输入1到7之间的一个整数,要求:若输入1则输出MONDAY,

2024-11-26 08:44:20
推荐回答(1个)
回答1:

#include

int main()
{
int n;
while(scanf("%d",&n)==1)
{
switch(n)
{
case 1:printf("1 MONDAY\n");break;
case 2:printf("2 TUESDAY\n");break;
case 3:printf("3 WEDNESDAY\n");break;
case 4:printf("4 THURSDAY\n");break;
case 5:printf("5 FRIDAY\n");break;
case 6:printf("6 SATURDAY\n");break;
case 7:printf("7 SUNDAY\n");break;
default:puts("error");
}
}
}