Guest User

Untitled

a guest
Oct 18th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int IsLeapYear(int year)
  4. {
  5. int x,y,z;
  6. x=year%4;
  7. y=year%100;
  8. z=year%400;
  9.  
  10. if(z==0)
  11. {
  12. return 1;
  13. }
  14. else if(y==0)
  15. {
  16. return 0;
  17. }
  18. else if(x==0)
  19. {
  20. return 1;
  21. }
  22. else
  23. {
  24. return 0;
  25. }
  26. }
  27.  
  28. int main()
  29. {
  30. int days = 366;
  31. int year = 2008;
  32.  
  33. while (days > 365)
  34. {
  35. if (IsLeapYear(year))
  36. {
  37. if (days > 365)
  38. {
  39. days -= 365;
  40. year += 1;
  41. }
  42. }
  43. else
  44. {
  45. days -= 365;
  46. year += 1;
  47. }
  48. }
  49. printf("Next day is \n");
  50. printf("Year: %d \n",year);
  51. printf("Days: %d \n",days);
  52. printf("END \n");
  53. }
Add Comment
Please, Sign In to add comment