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.41 KB | None | 0 0
  1. #include "stdio.h"
  2.  
  3. int isLeapYear(int year)
  4. {
  5. if((year % 4) == 0)
  6. {
  7. if((year % 100) == 0)
  8. {
  9. if((year % 400) == 0)
  10. {
  11. return 1;
  12. }
  13. else
  14. return 0;
  15. }
  16. else
  17. return 1;
  18. }
  19. else
  20. return 0;
  21. }
  22.  
  23.  
  24. int main()
  25. {
  26. int year;
  27. printf("Enter any year: ");
  28. scanf("%d", &year);
  29. if(isLeapYear(year)) {
  30. printf("%d is leap year!\n", year);
  31. } else {
  32. printf("%d is not leap year!\n", year);
  33. }
  34. return 0;
  35. }
Add Comment
Please, Sign In to add comment