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