I am trying to write a program that asks the user to enter an integer representing an hour (an hour range from 0 - 167) Lets assume Monday at midnight is 0 and Sunday at 11pm is 167.. I need to print out the day of the weak and time am or pm. Here is what i have thats not working.
Code:int main(void)
10
11 {
12
13 int hour;
14 #define day (Monday || Tuesday || Wednesday || Thursday || Friday || Saturday || Sunday)
15
16 printf("Enter hours: ");
17 scanf("%d", &hour);
18
19 if (hour < 24)
20 day = Monday;
21 else if (hour > 23 || hour < 48)
22 day = Tuesday;
23 else if (hour > 47 || hour < 72)
24 day = Wednesday;
25 else if (hour > 71 || hour < 96)
26 day = Thursday;
27 else if (hour > 95 || hour < 120)
28 day = Friday;
29 else if (hour > 119 || hour < 144)
30 day = Saturday;
31 else ( hour > 143 || hour < 168)
32 day = Sunday;
33
34 printf("Result: %d\n", day);