Enum Example Code - C

Enum Example

Snippet 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>,ampj); Dayy = Days(j); if(Dayy == Sunday || Dayy == Saturday) printf(<q>Holidayn</q>); else printf(<q>At workn</q>); return 0; } Output: ====== Please enter the day of the week (0 to 6): 0 Holiday.

Tags


Ask Questions

Ask Question