#include<stdio.h> main() { int y,m,d,t,f,s=0,i,j,k,d1=0,n,b=0,a; printf("enter year:"); scanf("%d",&y); printf("enter month:"); scanf("%d",&m); if(m<=0 || m>12) { printf("invalid month"); exit(0); } printf("enter day:"); scanf("%d",&d); if(d<=0 || d>31) { printf("invalid date"); exit(0); } y=y-1; y=y%400; t=y/4; f=y/100; i=t-f; j=y-i; i=2*i; k=i+j; n=k%7; s=s+n; if(m==2) d1=31; else if(m>=3) d1=59; for(a=4;a<=m;a++) { if(b==0) { d1=d1+31; if(a==8) b=0; else b=1; } else { d1=d1+30; b=0; } } d1=d1+d; k=d1%7; s=s+k; s=s%7; printf("\n"); switch(s) { case 0: printf("sunday"); break; case 1: printf("monday"); break; case 2: printf("tuesday"); break; case 3: printf("wednesday"); break; case 4: printf("thursday"); break; case 5: printf("friday"); break; case 6: printf("saturday"); break; } }
Tuesday, 12 February 2013
day calculator calendar
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment