7-13 the day after tomorrow

7-13 the day after tomorrow

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;
} 
Published 21 original articles · praised 0 · visits 39

Guess you like

Origin blog.csdn.net/weixin_47127378/article/details/105566408