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;
}
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;
}