Guest User

Untitled

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