1: #include<stdio.h>
2: #include<conio.h>
3: void main()
4: {
5: int leapdays,firstday,yr;
6: long int normaldays,totaldays;
7: clrscr();
8: printf(“Enter year “);
9: scanf(“%d”,&yr);
10: normaldays=(yr-1)*365L;
11: leapdays=(yr-1)/4-(yr-1)/100+(yr-1)/400;
12: totaldays=normaldays+leapdays;
13: firstday=totaldays%7;
14: if(firstday==0) printf(“\nMonday”);
15: if(firstday==1) printf(“\Tuesday”);
16: if(firstday==2) printf(“\nWednesday”);
17: if(firstday==3) printf(“\nThrusday”);
18: if(firstday==4) printf(“\nFriday”);
19: if(firstday==5) printf(“\nSaturday”);
20: if(firstday==6) printf(“\nSunday”);
21: printf(“\n\n\n\n\nPress any key to exit….”);
22: getch();
23: }
Comments
Post a Comment