如果今天是星期三,后天就是星期五;如果今天是星期六,后天就是星期一。我们用数字1到7对应星期一到星期日。给定某一天,请你输出那天的“后天”是星期几。
输入格式:
输入第一行给出一个正整数D
(1 ≤ D
≤ 7),代表星期里的某一天。
输出格式:
在一行中输出D
天的后天是星期几。
输入样例:
3
输出样例:
5
import java.util.Scanner;
public class Main {
public static void afterTomorrow() {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
if(N>=1&&N<=7) {
switch (N) {
case 1:
System.out.println("3");
break;
case 2:
System.out.println("4");
break;
case 3:
System.out.println("5");
break;
case 4:
System.out.println("6");
break;
case 5:
System.out.println("7");
break;
case 6:
System.out.println("1");
break;
case 7:
System.out.println("2");
break;
}
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
afterTomorrow();
}
}