Guest User

Untitled

a guest
Nov 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int IsLeapYear(int year) {
  4. if(year % 400 == 0){
  5. return 1;
  6. } else if(year % 100 == 0){
  7. return 0;
  8. } else if(year % 4 == 0){
  9. return 1;
  10. } else{
  11. return 0;
  12. }
  13. }
  14. int main(void)
  15. {
  16. int year = 2008;
  17. int days = 366;
  18. while (days > 365) {
  19. if (IsLeapYear(year)) {
  20. if (days > 366) {
  21. days -= 366;
  22. year += 1;
  23. }
  24. else {
  25. days -= 365;
  26. year += 1;
  27. }
  28. }
  29. }
  30.  
  31. printf("end\n");
  32. }
Add Comment
Please, Sign In to add comment