Categories

enumeration example

#include

typedef enum{Sun,Mon,Tue,Wed,Thu,Fri,Sat}days;

int main()
{
days number;
printf(“Please enter the number of the day of the week.n”);
scanf(“%d”,&number);
switch(number)
{
case 0 : printf(“the day is Sunday.n”); break;
case 1 : printf(“the day is Monday.n”); break;
case 2 : printf(“the day is Tuesday.n”); break;
case 3 : printf(“the day is Wednesday.n”); break;
case 4 : printf(“the day is thursday.n”); break;
case 5 : printf(“the day is Friday.n”); break;
case 6 : printf(“the day is saturday.n”); break;
}
return 0;
}

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

You must be logged in to post a comment.