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