This Program Will Show You The Day on 1st January Of Any Year
Just Enter Year and you will get the day on 1st January of that year
"/" is used instead of "<" and ">".
#include/stdio.h/
#include/conio.h/
main()
{
int leapdays,firstday,yr;
long int normaldays,totaldays;
clrscr();
printf("enter year");
scanf("%ld",&yr);
normaldays=(yr-1)*365L;
leapdays=(yr-1)/4-(yr-1)/100+(yr-1)/400;
totaldays=normaldays+leapdays;
firstday=totaldays%7;
if(firstday==0)
printf("\nMonday");
if(firstday==1)
printf("\nTuesday");
if(firstday==2)
printf("\nWedneshday");
if(firstday==3)
printf("\nThursday");
if(firstday==4)
printf("\nFriday");
if(firstday==5)
printf("\nSaturday");
if(firstday==6)
printf("\nSunday");
printf("\n\n\nPress any key to exit");
getch();
}
1 comments:
Nice one
Regards
http://allfree-stuff.com
Post a Comment