topic
If today is Wednesday, the day after tomorrow is Friday; if today is Saturday, the day after tomorrow is Monday. We use numbers 1 to 7 for Monday to Sunday. Given a certain day, please output the day of the day after "the day after tomorrow".
Input format:
Enter the first line to give a positive integer D (1 ≤ D ≤ 7), representing a day of the week.
Output format:
The day after the day D is output on a line is the day of the week.
Sample input:
3
Sample output:
5
Code
#include<stdio.h>
int main(){
int D;
scanf("%d",&D);
if(D>=1 && D<=7){
if(D+2<=7){
printf("%d",D+2);
}else{
printf("%d",D-5);
}
}
return 0;
}