According to Gregorian Calender it was Monday on the date 01/01/01.If any year is input through the keyboard. WAP to find out what is the day on 1st January of this Year.
#include<stdio.h> #include<conio.h> void main() { int y,d=0,i,ch=0; clrscr(); printf("enter the year"); scanf("%d",&y); for(i=1990;i<y;i++) { if(i%4==0) d=d+366; else d=d+365; } ch=d%7; switch(ch) { case 0: printf("monday"); break; case 1: printf("tuesday"); break; case 2: printf("wednesday"); break; case 3: printf("thursday"); break; case 4: printf("friday"); break; case 5: printf("saturday"); break; case 6: printf("sunday"); break; defaut: printf("invalid option"); } getch(); }