Cannot get my Code in C to work

Asterios

Estimable
Oct 19, 2014
2
0
4,510
0
My code is supposed to be pretty simple I've searched around the web but can't find much that helps so I was wondering if my code should be a switch statement rather than an if one...

Here's my code...

#include <stdio.h>

int main(void)
{
int num;
scanf("%d",&num);
if (num <= 4 && num >= 11)
{
printf ("Good Morning!");
}
else if (num <=12 && num >=18)
{
printf ("Good Afternoon");
}
else if (num <=19 && num >=23)
{
printf ("Good Evening");
}
else if (num <=0 && num >=3)
{
printf("Good Night!");
}
else
{
printf ("Error Invalid Output!");
}
return 0;
}
 

Asterios

Estimable
Oct 19, 2014
2
0
4,510
0


You're right thanks - however this isn't homework. Thanks for the help!
 

ASK THE COMMUNITY