Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int birthdayDay(int days, int month, int year);
- int main(int argc, char const *argv[]) {
- birthdayDay(31,1,2018);
- return 0;
- }
- int birthdayDay(int days, int month, int year){
- if (month == 1){
- year -= 1;
- month = 13;
- }
- if (month == 2){
- year -= 1;
- month = 14;
- }
- int k = (year % 100);
- int j = (year / 100);
- int h1 = days +
- ( (13 * (month + 1) ) / 5) +
- k +
- ( k / 4 ) +
- ( j / 4 ) +
- ( 5 * j);
- int h = h1 % 7;
- switch (h) {
- case 0 : printf("You were born on Saturday"); break;
- case 1 : printf("You were born on Sunday"); break;
- case 2 : printf("You were born on Monday"); break;
- case 3 : printf("You were born on Tuesday"); break;
- case 4 : printf("You were born on Wednesday"); break;
- case 5 : printf("You were born on Thursday"); break;
- case 6 : printf("You were born on Friday"); break;
- }
- return 0;
- }
Advertisement