Program to Find Whether Weekday or Weekend using an EnumWrite a program to find whether weekday or weekend using an Enum.
Answers
Answered by
2
#include<stdio.h>
int main()
{
enum Day {Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday};
enum Day today;
int x;
printf("please enter the day of the week(0 to 6)\n");
scanf("%d",&x);
today=x;
if(today==Sunday || today==Saturday)
printf("At last! Its the weekend\n");
else
printf("Week day.get back to work\n");
return 0;
}
int main()
{
enum Day {Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday};
enum Day today;
int x;
printf("please enter the day of the week(0 to 6)\n");
scanf("%d",&x);
today=x;
if(today==Sunday || today==Saturday)
printf("At last! Its the weekend\n");
else
printf("Week day.get back to work\n");
return 0;
}
Similar questions