如果今天是星期三,后天就是星期五;如果今天是星期六,后天就是星期一。我们用数字1到7对应星期一到星期日。给定某一天,请你输出那天的“后天”是星期几。
输入格式:
输入第一行给出一个正整数D(1 ≤ D ≤ 7),代表星期里的某一天。
输出格式:
在一行中输出D天的后天是星期几。
输入样例:
3
输出样例:
5
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int a=0;
scanf("%d",&a);
if(a<=5){
printf("%d",a+2);
}else if(a==6){
printf("%d",1);
}
else if(a==7)
{
printf("%d",2);
}
return 0;
}