L1-024. The day after tomorrow

 If today is Wednesday, the day after tomorrow is Friday; if today is Saturday, the day after tomorrow is Monday. We use the numbers 1 to 7 for Monday to Sunday. Given a certain day, please output the day of the week the day after tomorrow.

Input format:

The first line of input gives a positive integer D (1 <= D <= 7) representing the day of the week.

Output format:

The day of the week after outputting D days in one line.

Input sample:
3
Sample output:
5

Code:

#include<stdio.h>
int a[7]={1,2,3,4,5,6,7};
intmain()
{
    int i,j,n,m,k,t;
    scanf("%d",&n);
    printf("%d",a[(n+1)%7]);
    return 0;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325517560&siteId=291194637