#include<stdio.h>
#include<conio.h>
main()
{
int a[126];
int yy1[7]={6,0,1,2,3,4,5};
int yy2[7]={5,6,0,1,2,3,4};
int yy3[7]={4,5,6,0,1,2,3};
int yy4[7]={3,4,5,6,0,1,2};
int yy5[7]={2,3,4,5,6,0,1};
int yy6[7]={1,2,3,4,5,6,0};
int yy7[7]={0,1,2,3,4,5,6};
int gun,ay,yil,yy,dyil,ayd,kalan,i,deg,ayk,sira,t1,t5,sira1,top,say;
char devam;
do
{
clrscr();
do
{
printf("Gn giriniz=");scanf("%d",&gun);
}
while(gun>=32);
do
{
printf("Ay giriniz=");scanf("%d",&ay);
}
while(ay>=13);
do
{
printf("Yl giriniz=");scanf("%d",&yil);
}
while(yil<=1599 || yil>=2800);
yy=yil/100;
dyil=yy*100;
a[1]=dyil;
for (i=2;i<=125;i++)
{
dyil++;
if ((i%5)==0) {a[i]=0;dyil--;}
else a[i]= dyil;
}
a[126]=0;
for (i=1;i<=126;i++)
{
if (a[i]==yil) deg=i;
}
sira=deg%7;
if (sira==0) sira=7;
sira--;
if ((yy==17)||(yy==21)||(yy==25)) t1=yy1[sira];
if ((yy==18)||(yy==22)||(yy==26)) t1=yy3[sira];
if ((yy==19)||(yy==23)||(yy==27)) t1=yy5[sira];
if ((yy==16)||(yy==20)||(yy==24)||(yy==30)) t1=yy6[sira];
//2.tablo
if (yil%4==0)
{
if (ay==5) ayk=1;
if ((ay==2)|| (ay==8)) ayk=2;
if ((ay==3)||(ay==11)) ayk=3;
if (ay==6) ayk=4;
if ((ay==9)||(ay==12)) ayk=5;
if ((ay==1)||(ay==4)||(ay==7)) ayk=6;
if ((ay==10))ayk=7;
ayd=t1+ayk;
if (ayd>=7)
kalan=ayd%7;
else kalan=ayd;
}
else
{
if (ay==5) ayk=1;
if (ay==8) ayk=2;
if ((ay==2)||(ay==3)||(ay==11)) ayk=3;
if (ay==6) ayk=4;
if ((ay==9)||(ay==12)) ayk=5;
if ((ay==4)||(ay==7)) ayk=6;
if ((ay==1)||(ay==10))ayk=7;
ayd=t1+ayk;
if (ayd>=7)
kalan=ayd%7;
else kalan=ayd;
}
//3.tablo
while(gun>=7)gun=gun-7;
say=kalan+gun;
if (say>=7)
top=say%7;
else top=say;
switch(top)
{
case 1:printf("cumartesi");break;
case 2:printf("pazar");break;
case 3:printf("pazartesi");break;
case 4:printf("sal");break;
case 5:printf("‡arŸamba");break;
case 6:printf("perŸembe");break;
case 0:printf("cuma");break;
}
printf("\n\n\ndevam etmek istiyormusunuz..e..h..::");
devam=getche();
}
while(devam!='h');
getch();
}