Program 1:
Program to find whether week day or week end using enum
#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("Enjoy! Its the weekend\n");
else
printf("Week day.do your work\n");
return 0;
}
Output
Please enter the day of the week(0 to 6)
0
Enjoy! Its the Weekend
Program 2:
Program to find the month
#include<stdio.h>
int main()
{
enum months {Jan=1,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec};
enum months month;
printf("month=%d\n",month=Feb);//Assign integer value
return 0;
}
Output
month=2
Program 3:
Program to return the number of days in a month using enum
#include<stdio.h>
int main()
{
enum months {Jan=31,Feb=28,Mar=31,Apr=30,May=31,Jun=30,Jul=31,Aug=31,Sep=30,Oct=31,Nov=30,Dec=31};
enum months month;
printf("days=%d\n",month=Feb);
return 0;
}
Output
days=28
very nice
ReplyDeleteCan you write a program for structure, union, and typedef
ReplyDeleteAnd says that difference
ReplyDeleteProgram1:error(cannot convert int to enum) in today=x;
ReplyDeleteSo we can clear the error by changing today=(Day)x;
Pretty nice post. I just stumbled upon your blog and wanted to say that I've really enjoyed browsing your blog posts. In any case I will be subscribing to your feed and I hope you write again soon!
ReplyDeleteMy website info
I was recommended this web site by my cousin.
ReplyDeleteI am not sure whether this post is written by him as nobody else know such detailed about my trouble.
You are amazing! Thanks!
Feel free to surf to my page: her Comment Is Here
Wow, wonderful blog layout! How long have you been blogging for?
ReplyDeleteyou make blogging look easy. The overall look of your website is excellent, as well as the content!
my page Great Post To read
What's up to all, how is everything, I think every one is getting more from this site, and your views are fastidious in support of new viewers.
ReplyDeleteLook at my blog post; I was reading this
Wow, awesome blog layout! How long have you been blogging for?
ReplyDeleteyou make blogging look easy. The overall look of your site is magnificent, as well
as the content!
Look into my website; for more info
My page: learn more here
Appreciate the recommendation. Let me try it out.
ReplyDeleteStop by my web blog ... Www.propertywide.co.uk
Why people still make use of to read news papers when in this technological world the whole thing is presented on net?
ReplyDeleteStop by my homepage :: Buy Commercial Property buckinghamshire
Highly descriptive post, I loved that a lot. Will
ReplyDeletethere be a part 2?
Also visit my web-site :: garcinia cambogia review
Excellent blog here! Also your web site loads up very fast!
ReplyDeleteWhat web host are you using? Can I get your affiliate link to your host?
I wish my site loaded up as quickly as yours lol
We're a bunch of volunteers and opening a brand new scheme in our community. Your site provided us with useful information to work on. You've
ReplyDeletedone a formidable process and our whole community will probably be thankful
to you.
My web page ... explained here
There is definately a lot to find out about this issue. I
ReplyDeletereally like all the points you've made.
Here is my weblog :: Www.propertywide.co.uk
I do not drop many responses, however i did
ReplyDeletesome searching and wound up here "Enum Example programs in C".
And I actually do have a couple of questions for you if it's allright. Could it be just me or does it seem like a few of these responses look like they are coming from brain dead individuals? :-P And, if you are posting at additional online sites, I'd like to keep up with anything new you have to post.
Could you make a list of every one of all your community pages like your linkedin profile,
Facebook page or twitter feed?
Here is my page: read review
Hi, i think that i saw you visited my site so i came to ?return the favor?
ReplyDelete.I am attempting to find things to improve my site!
I suppose its ok to use a few of your ideas!!
Take a look at my blog: a replacement
Everything is very open with a clear description of the issues.
ReplyDeleteIt was definitely informative. Your website is very useful.
Thank you for sharing!
Look at my webpage :: see page
electronic cigarette reviews, electronic cigarette reviews, smokeless cigarettes, electronic cigarettes, vapor cigarette, smokeless cigarette
ReplyDelete