#include<stdio.h>
main()
{ int y; /* year */
int m; /* month */
int d;/* date (day) */
int y1=2015;/* present year */
int age;
int newdate; /* day of the week */
printf("Please enter the year :\n");
scanf("%d", &y);
printf("Enter the number of the month:\n");
scanf("%d", &m);
if (m < 3)
{ m = m + 12; y = y - 1; }
printf("Enter the date: \n");
scanf("%d", &d);
newdate = (d + (2 * m) + ((6 * (m + 1)) / 10) + y + (y / 4) -(y / 100) + (y / 400) + 1) % 7;
switch (newdate)
{ case 0:
{ puts("The day is Sunday.");
break; }
case 1: { puts("The day is Monday.");
break; }
case 2: { puts("The day is Tuesday.");
break; }
case 3: { puts("The day is Wednesday.");
break; }
case 4: { puts("The day is Thursday.");
break; }
case 5: { puts("The day is Friday.");
break; }
case 6: { puts("The day is Saturday.");
break; }
default: { puts("You goofed!");
}
}
age = y1-d;
printf("yur age is ");
scanf("%d",&age);
return 0;
}
main()
{ int y; /* year */
int m; /* month */
int d;/* date (day) */
int y1=2015;/* present year */
int age;
int newdate; /* day of the week */
printf("Please enter the year :\n");
scanf("%d", &y);
printf("Enter the number of the month:\n");
scanf("%d", &m);
if (m < 3)
{ m = m + 12; y = y - 1; }
printf("Enter the date: \n");
scanf("%d", &d);
newdate = (d + (2 * m) + ((6 * (m + 1)) / 10) + y + (y / 4) -(y / 100) + (y / 400) + 1) % 7;
switch (newdate)
{ case 0:
{ puts("The day is Sunday.");
break; }
case 1: { puts("The day is Monday.");
break; }
case 2: { puts("The day is Tuesday.");
break; }
case 3: { puts("The day is Wednesday.");
break; }
case 4: { puts("The day is Thursday.");
break; }
case 5: { puts("The day is Friday.");
break; }
case 6: { puts("The day is Saturday.");
break; }
default: { puts("You goofed!");
}
}
age = y1-d;
printf("yur age is ");
scanf("%d",&age);
return 0;
}
day find
Reviewed by Shobhit Goel
on
August 10, 2015
Rating:
No comments:
Post a Comment