26277 total geeks with 3498 solutions
Recent challengers:
 Welcome, you are an anonymous user! [register] [login] Get a yourname@osix.net email address 

Articles

GEEK

User's box
Username:
Password:

Forgot password?
New account

Shoutbox
MaxMouse
It's Friday... That's good enough for me!
CodeX
non stop lolz here but thats soon to end thanks to uni, surely the rest of the world is going good?
stabat
how things are going guys? Here... boring...
CodeX
I must be going wrong on the password lengths then, as long as it was done on ECB
MaxMouse
lol... the key is in hex (MD5: of the string "doit" without the "'s) and is in lower case. Maybe i should have submitted this as a challenge!

Donate
Donate and help us fund new challenges
Donate!
Due Date: May 31
May Goal: $40.00
Gross: $0.00
Net Balance: $0.00
Left to go: $40.00
Contributors


News Feeds
The Register
I know who "Satoshi
Nakamoto" is, says
Ted Nelson
Google builds
crowdsourcing into
new Maps code stack
Google"s Native
Code browser tech
goes cross-platform
Yahoo! to "share
something special"
in New York on
Monday
Adobe"s Creative
Cloud fails at
being a cloud
NASA signs off on
sampling mission to
Earth-threatening
asteroid
US military
welcomes Apple iOS
6 kit onto its
networks
Jailed Romanian
hacker repents,
invents ATM
security scheme
Climate scientists
agree: Humans cause
global warming
MIT takes
battery-powered
robot cheetah for a
gallop
Slashdot
Charge Your
Cellphone In 20
Seconds
(Eventually)
Yahoo! Japan May
Have Had 22 Million
User IDs Stolen
Ask Slashdot: Why
Do Firms Leak
Personal Details In
Plain Text?
Data Center
Managers Weary of
Whittling Cooling
Costs
Canadian Cellphone
Users May Get
Justice Over
Phantom Charges
Wired Writer
Imagines Google
Island
Syrian Electronic
Army Hits Financial
Times Sites, Feeds
Arduino Branches
Out, With a
Plug-and-Program
Robot
After Kickstarter
Record, Pebble
Smartwatch Lands
$15M From VCs
Electronics-Loving
"Crazy Ants"
Invading Southern
US
View Blog
C
by amisauv on Tue 9th Dec 10am



This program prints Weekdays of specified date. It even prints calendar of a given year too.

/*Ccalendar library*/
#include<stdio.h>
#include<string.h>
#include<conio.h>
int getNumberOfDays(int month,int year)
{
switch(month)
{
case 1 : return(31);
case 2 : if(year%4==0)
return(29);
else
return(28);
case 3 : return(31);
case 4 : return(30);
case 5 : return(31);
case 6 : return(30);
case 7 : return(31);
case 8 : return(31);
case 9 : return(30);
case 10: return(31);
case 11: return(30);
case 12: return(31);
default: return(-1);
}
}
char *getName(int odd)
{
switch(odd)
{
case 0 :return("Sunday");
case 1 :return("Monday");
case 2 :return("Tuesday");
case 3 :return("Wednesday");
case 4 :return("Thursday");
case 5 :return("Friday");
case 6 :return("Saturday");
default:return("Error in getName() module.Invalid argument
passed");
}
}
int getOddNumber(int day,int mon,int year)
{
int res=0,t1,t2,y=year;
year = year-1600;
while(year>=100)
{
res=res+5;
year=year-100;
}
res=(res%7);
t1=((year-1)/4);
t2=(year-1)-t1;
t1=(t1*2)+t2;
t1=(t1%7);
res = res+t1;
res=res%7;
t2=0;
for(t1=1;t1<mon;t1++)
{
t2+=getNumberOfDays(t1,y);
}
t2 = t2+day;
t2 = t2%7;
res = res+t2;
res = res%7;
if(y>2000)
res=res+1;
res = res%7;
return res;
}
char *getWeek(int dd,int mm,int yy)
{
int odd;
if(!(mm>=1 && mm<=12))
{
return("Invalid month value");
}
if(!(dd>=1 && dd<=getNumberOfDays(mm,yy)))
{
return("Invalid date");
}
if(yy>=1600)
{
odd = getOddNumber(dd,mm,yy);
odd=odd%7;
return(getName(odd));
}
else
{
return("
Please give year more than 1600");
}
}
void printMonth(int mon,int year,int x,int y)
{
int nod,odd,cnt,d=1,x1=x,y1=y;
if(!(mon>=1 && mon<=12))
{
printf("
INVALID MONTH");
getch();
return;
}
if(!(year>=1600))
{
printf("
INVALID YEAR");
getch();
return;
}
if(x<=0)
x=wherex();
if(y<=0)
y=wherey();
gotoxy(x,y);
textcolor(RED);
cprintf("S");
textcolor(YELLOW);
cprintf(" M T W T F S");
/* 1234567891234567891234567 */
textcolor(7);
cprintf("");
y++;
nod=getNumberOfDays(mon,year);
odd=getOddNumber(d,mon,year);
switch(odd)
{
case 0 : x=x;
cnt=1;
break;
case 1 : x=x+4;
cnt=2;
break;
case 2 : x=x+8;
cnt=3;
break;
case 3 : x=x+12;
cnt=4;
break;
case 4 : x=x+16;
cnt=5;
break;
case 5 : x=x+20;
cnt=6;
break;
case 6 : x=x+24;
cnt=7;
break;
default : printf("

INVALID DATA FROM THE getOddNumber()
MODULE");
return;
}
gotoxy(25,25);
gotoxy(x,y);
printf("%02d",d);
for(d=2;d<=nod;d++)
{
if(cnt%7==0)
{
y++;
cnt=0;
x=x1-4;
}
x = x+4;
cnt++;
gotoxy(x,y);
printf("%02d",d);
}
}
main()
{
char ch='k';
int dd,mm,yy;
while(ch!='0')
{
clrscr();
printf("




1.Know the day");
printf("
2.Print the month");
printf("
0.EXIT");
printf("

ENTER YOUR CHOICE : ");
flushall();
fflush(stdin);
ch=getche();
clrscr();
switch(ch)
{
case '1': printf("Enter date (DD MM YYYY) : ");
scanf("%d %d %d",&dd,&mm,&yy);
printf("
Day is : %s",getWeek(dd,mm,yy));
flushall();
getch();
break;
case '2' : printf("Enter month and year (MM YYYY) : ");
scanf("%d %d",&mm,&yy);
printf("

");
printMonth(mm,yy,-1,-1);
flushall();
getch();
break;
case '0' : exit(0);
}
}
}
C blogs amisauv's blog
Comments:
Anonymous
2011-07-16 15:27:17
I was really cofneusd, and this answered all my questions.
Anonymous
2011-07-17 19:44:06
uXkmma , viejbetojsvc, [link=http://fbrtltzzdkmk.com/]fbrtltzzdkmk[/link], http://wkepqhblyxra.com/
Anonymous
2011-07-19 06:22:17
ppo dental insurance inpi group health insurance >:-D
Anonymous
2011-07-20 04:53:42
levitra addicting online games 8607 ultram htv
Anonymous
2011-07-21 05:15:02
cheap auto insurance 99568 online auto insurance quotes gpopt
Anonymous
2011-07-21 10:38:58
medicare health insurance 6569 health insurance small business =-]]]
Anonymous
2011-07-21 12:10:35
state auto insurance 567100 cheap auto insurance >:-] affordable car insurance 55606
Anonymous
2011-07-23 02:31:44
Do you want to buy your personalized jerseys? There are three kinds of cheap authentic nba jerseys are arrival for you to choose. One is cheap MLB jerseys,the other two are wholesale nfl jerseys and wholesale nba jerseys. NFL throwback jerseys and authentic mlb jerseys are playing an important part in our classmates' everyday lives. They say that cheap nfl throwback jerseys could make them perfect. Either when they are playing balls or just in their everyday lives, NFL jerseys wholesale could make them more comfortable. Jose, who is my best friend, says that cheap nfl jerseys and nfl jerseys for cheap could save their family more, all their family love to share discount authentic jerseys online. Wholesale jerseys and cheap jerseys for sale online could save us more than buying from retail store.
Anonymous
2011-07-23 04:31:38
health insurance online vxq medicare health insurance rbfoy
Anonymous
2011-07-24 07:36:28
cheap auto insurance :-O cheap auto insurance 4149 life insurance quotes %O
Anonymous
2011-07-27 04:34:19
car insurance qoutes 8-]] maryland health insurance plan 858 cheap california auto insurance tbv
Anonymous
2011-07-27 05:47:28
generic viagra levitra and tadalafil %OOO cheap generic cialis =(
Anonymous
2011-07-27 07:19:47
cialis :[[[ nexium 8D
Anonymous
2011-07-28 02:50:54
health insurance zmujq adova health insurance 286
Anonymous
2011-07-31 04:21:53
dental health insurance 101 family health insurance rate =PPP group health insurance >:-))
Anonymous
2011-08-01 03:04:25
home insurance =))) medical insurance >:PPP
Anonymous
2011-08-03 05:12:15
accutane 61126 diet pill acomplia also called rimonaban 171523
Anonymous
2011-08-11 03:27:46
cheap home insurance fou small business insurance cost zzhup
Anonymous
2011-08-11 06:21:11
cheap auto insurance 2316 home insurance 3645
Anonymous
2011-08-12 09:22:50
auto insurance quotes wrzwh car insurance sncpx
Anonymous
2011-08-13 09:53:21
auto insurance %[ cheapest car insurance 3413
Anonymous
2011-08-14 06:04:16
cheap health insurance >:]] health insurance ilvz
Anonymous
2011-08-15 05:43:36
levitra 1717 cialis >:-]]
Anonymous
2011-08-15 09:50:58
home insurance 227 home insurance coverage 8-OO
Anonymous
2011-08-29 09:36:19
The Philippine health plan, is invited cheap jerseys to do to promote Sri Lanka handsome man. "Last year I participated in this program in the Philippines, so wholesale nhl jerseys this year, longer back, I am very excited," Adams said handsome, "health and sports are very important, but denver broncos jersey the NBA this program is a great opportunity I can do something for the Filipino people.
Anonymous
2011-11-01 06:05:41
Bigger <a href='http://www.outletcoach-online.us'><strong>Coach Store Outlet Online</strong></a> businesses or these seeking to <a href='http://www.coach-online-outlet.us'><strong>Coach Factory</strong></a> a great deal of <a href='http://www.coach-factorysoutletonline.us'><strong>Coach Factory Outlet</strong></a> workers are much better away asking for guidance from skilled <a href='http://www.coachfactoryoutlet-online.com'><strong>Coach Factory Outlet Online</strong></a> brokers prior to employing a new useless teacher because the <a href='http://www.coachfactoryoutlet-online.us/new-arrivals-c-74.html'><strong>Coach Diaper Bag Outlet</strong></a> requirements of numerous will vary from <a href='http://www.coachonline-outlet.us/new-arrivals-c-74.html'><strong>Coach Factory Store</strong></a> people. Ensure that you keep in mind these <a href='http://www.coachonline-outlet.us'><strong>Coach Factory Outlet</strong></a> important digs up, if you want to shine in life within the blossoming <a href='http://www.coachfactorysoutletonline.us'><strong>Coach Outlet Online</strong></a> business of company coaching. Stay up to date using the newest methods, equipment and initiatives on the planet of coaching.
Anonymous
2011-12-01 20:46:58
llahkptjy, <a href="http://123reputationmanagement.org/">Brand reputation management on the internet</a>, WOJrVqG, Online reputation management services, nSqjnnl, http://123reputationmanagement.org/ Articles on publishing companies with reputation management problems and 2011, jzinPUF, <a href="http://excellenthostzone.com/">hostrocket promotional code</a>, PizIorD, hostrocket web services, rxAtFHi, http://excellenthostzone.com/ hostrocket web services, wVCunFy, <a href="http://offersham.com/">circuit city coupons</a>, oRUOJOc, circuit city coupons, XTMjKxr, http://offersham.com/ circuit city coupon, cblbDEU, <a href="http://www.thestonefish.net/">Cialis online no rx canada</a>, wUYLIJH, Cialis tablets, ekayEdd, http://www.thestonefish.net/ Cialis 5mg, xaDXKqc, <a href="http://aboutvpshosting.com/">Forex vps hosting windows 2008</a>, IVIEQDa, What is vps hosting solutions, XVSSbFb, http://aboutvpshosting.com/ Hosting posicionamiento seo dominios servidores vps reseller diseño diseno paginas web tiendas virtualesecommerce php html marketing publicidadonlinebuscadores, tZeYkeX, <a href="http://trustworthyhost.com/">lunarpages reviews</a>, kWBzFSp, lunarpages coupon, LRqUYaO, http://trustworthyhost.com/ lunarpages coupon code, zazPySs.
Anonymous
2012-02-17 12:47:31
oumkyo
Anonymous
2012-02-20 19:33:30
ozfkmjr http://fastpaydayloansus.com/ payday loans MGgvq <a href="http://fastpaydayloanscanada.ca/ ">Payday Loan</a> 7163 Payday Loans UK 8]]]
Anonymous
2012-04-19 15:26:23
dshmmq cialis =-] cialis no prescription fOkQFz viagra RpUzH generic viagra >:-[ viagra vvjNX cialis %-[[[
Anonymous
2012-04-27 17:11:17
ldoyrbtb cialis avsQM viagra LwGLF generic viagra IKhFkT cialis >:]]
Anonymous
2013-04-07 11:26:09
wddxll how to order viagra 7598 cialis order express 7094
Anonymously add a comment: (or register here)
(registration is really fast and we send you no spam)

Related Blogs


Blog entry for Thu 3rd Apr 11am by venkatvasa on Thu 3rd Apr 11am

can anyone explain me the statement "pid=wait(&status)" in
the example(father, son) for fork(), given in the articles of C.
venkatvasa's blog

Blog entry for Wed 2nd Apr 12pm by arhant on Wed 2nd Apr 12pm

Hi all,

Pl. tell me the good resources for learning C++ from scratch to advance.

Regards
arhant's blog

About Me
n:amisauv
View my Profile

Recent Blogs
Creating a
Lexical
Analyzer in C
Tue 9th Dec 11am
Controling
digital circuit
through
computer
Tue 9th Dec 10am
/* Computerised
Electrical
Equipment
Control */ /*
PC BASED DEVICE
CONTROLLER *
Tue 9th Dec 10am
Calendar
Program
Tue 9th Dec 10am
Calculator:
Tue 9th Dec 10am

Link To Me
My Rss Feed
My Blog
My Articles
My Profile


 

     
Your Ad Here
 
Copyright Open Source Institute, 2006