Zeller Algorithm

Zeller devised an algorithm to predict the day of week for any date between year 1582 and 4902. This is a very popular algorithm. The algorithm has been given below:


int zeller(int dd,int mm,int yy)
{
int i;
int zm,zy;
if(mm<3)
zm=mm+10;
else
zm=mm-2;
if(zm>10)
zy=yy-1;
else
zy=yy;
i=((((13*zm-1)/5)+dd+zy%100+((zy%100)/4)-2*(zy/100)+(zy/400)+77)%7);
return i;
}

You can download the full C language source code for this site from the attachment.


AttachmentSize
zeller.cpp1.56 KB
Copyright Satya Services - 2008