Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int isLeapYear(int year)
- {
- if(year%4==0)
- {
- if(year%400==0)
- {
- return 1;
- }
- if(year%100==0)
- {
- return 0;
- }
- return 1;
- }
- return 0;
- }
- int main()
- {
- int year=2008;
- int days=366;
- while (days > 365)
- {
- if (isLeapYear(year))
- {
- if (days > 366)
- {
- days -= 366;
- year += 1;
- }
- break;
- }
- else
- {
- days -= 365;
- year += 1;
- }
- }
- printf("End\n");
- printf("%d\n",year);
- printf("%d\n",days);
- }
Add Comment
Please, Sign In to add comment