|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
我的理解好像行不通
#include <stdio.h>
#include <stdlib.h>
int main()
{
int stuNum=0,remainder=-1,weekNum=0;
printf("请输入学号([142011001,142015000>):");
scanf("%d",&stuNum);
if (stuNum>=142011001 && stuNum<142015000){
printf("请输入周数([1,20]):");
scanf("%d",&weekNum);
if(weekNum>= 1 && weekNum<20){
remainder=stuNum%10;
switch(remainder%3){
case 0:
if(weekNum%3==0){
printf("学生%10d在第%3d周交作业吗?是\n",stuNum,weekNum);
}else{
printf("学生%10d在第%3d周交作业吗?否\n",stuNum,weekNum);
}
break;
case 1:
if(weekNum%3==1){
printf("学生%10d在第%3d周交作业吗? 是\n",stuNum,weekNum);
}else{
printf("学生%10d在第%3d周交作业吗?否\n",stuNum,weekNum);
}
break;
case 2:
if(weekNum%3==2){
printf("学生%10d在第%3d周交作业吗?是\n",stuNum,weekNum);
}else{
printf("学生%10d在第%3d周交作业吗?否\n",stuNum,weekNum);
}
break;
}
}else
printf("周数输入错误,应该在[1,20]内");
}else
printf("学号输入错误,应该在[142011001,142015000>内");
return 0;
}
|
|