Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define BIRTH 803433600
- #include <stdio.h>
- #include <time.h>
- int main()
- {
- time_t from1970 = time(NULL);
- int seconds, days, months, years;
- int timeleft; //the time that "escaped" using integer
- int birthday;
- seconds=difftime(from1970, BIRTH);
- days=seconds/86400;
- years=days/365;
- months=years*12;
- timeleft=days%365;
- months=months+(timeleft/30);
- birthday = 365 - timeleft;
- months=months%12;
- days=days%30;
- printf("It passed %d years %d months %d days since your birth\n",years,months,days);
- printf("Its %d days to your birthday", birthday); // blad to okolo 10 dni wiec jest OK
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement