#include <stdio.h>
#include <conio.h>
void main()
{
int yr,ldays,day;
long int ndays,tdays;
clrscr();
printf("Enter any Year");
scanf("%d",&yr);
ndays=(yr-1)*365L;
ldays=(yr-1)/4+(yr-1)/400-(yr-1)/100;
tdays=ndays+ldays;
day=tdays % 7;
switch(day)
{
case 0: printf("Monday");
break;
case 1: printf("Tuesday");
break;
case 2: printf("Wednesday");
break;
case 3: printf("Thrsday");
break;
case 4: printf("Friday");
break;
case 5: printf("Saturday");
break;
case 6: printf("Sunday");
}
getch();
}
#include <conio.h>
void main()
{
int yr,ldays,day;
long int ndays,tdays;
clrscr();
printf("Enter any Year");
scanf("%d",&yr);
ndays=(yr-1)*365L;
ldays=(yr-1)/4+(yr-1)/400-(yr-1)/100;
tdays=ndays+ldays;
day=tdays % 7;
switch(day)
{
case 0: printf("Monday");
break;
case 1: printf("Tuesday");
break;
case 2: printf("Wednesday");
break;
case 3: printf("Thrsday");
break;
case 4: printf("Friday");
break;
case 5: printf("Saturday");
break;
case 6: printf("Sunday");
}
getch();
}
0 comments :
Post a Comment