Enums

Lab C Beginner 10 points

Define enum Day { MON, TUE, WED, THU, FRI, SAT, SUN };. Read a day number 0–6 and print weekend or weekday, and the next day's number.

Input

n, then n integers 0–6.

Output

n lines: kind next

Example

Input

3
0
5
6

Output

weekday 1
weekend 6
weekend 0
Sample input available Sample output available
Editor
C

Hints

Enum constants are integers starting at 0.

Solution explanation

Enums give names to related integer constants, making code self-documenting.

Show solution
#include <stdio.h>

enum Day { MON, TUE, WED, THU, FRI, SAT, SUN };

int main() {
    int n, d;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &d);
        enum Day day = d;
        printf("%s %d\n", (day == SAT || day == SUN) ? "weekend" : "weekday", (day + 1) % 7);
    }
    return 0;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD