Guest User

Untitled

a guest
Oct 18th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 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. break;
  35. }
  36. else
  37. {
  38. days -= 365;
  39. year += 1;
  40. }
  41. }
  42. printf("End\n");
  43. printf("%d\n",year);
  44. printf("%d\n",days);
  45. }
Add Comment
Please, Sign In to add comment