//This code is designed by codenation.
// 22:24 Mon 16/11/2020
//Consider there was Monday on 01/01/1900
#include<stdio.h>
int main()
{
int yr, lp_yrs,normal_years, difference, total_days, day_of_week;
printf("Enter the year above 1900:");
scanf ("%d", &yr);
difference = yr-1900;
lp_yrs = difference / 4;
normal_years=difference-lp_yrs;
total_days = (normal_years*365) + lp_yrs*366 ;
day_of_week = total_days % 7;
switch(day_of_week)
{
case 0:
printf("The day on Jan 1st of this year is Monday");
break;
case 1:
printf("The day on Jan 1st of this year is Tuesday");
break;
case 2:
printf("The day on Jan 1st of this year is wednesday");
break;
case 3:
printf("The day on Jan 1st of this year is Thursday");
break;
case 4:
printf("The day on Jan 1st of this year is friday");
break;
case 5:
printf("The day on Jan 1st of this year is saturday");
break;
case 6:
printf("The day on Jan 1st of this year is sunday");
break;
}
}
Comments
Post a Comment