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