C Programming Tips & Tricks





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Code Snippets
 List All
 Arrays
 Calculators
 Datatypes
 Date & Time
 File Manipulation
 Math Functions
 Multimedia
 Others
 




Enum Example Code - C

Snippets  C  Enum Example Code
Snippet On
Enum Example




Code
  
Rate this page :
  [ 0 votes]


#include <stdio.h>
int main()
{
enum Days {Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday};
Days Dayy;
int j = 0;
printf(<q>Please Enter the day(0 to 6)\n</q>);
scanf(<q>%d</q>,&j);
Dayy = Days(j);
if(Dayy == Sunday || Dayy == Saturday)
printf(<q>Holiday\n</q>);
else
printf(<q>At work\n</q>);
return 0;
}

Output:
======
Please enter the day of the week (0 to 6): 0
Holiday.




Other Links

web hosting