Guest User

Untitled

a guest
Oct 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include "stdio.h"
  2.  
  3. int isLeapYear(int year)
  4. {
  5. if (year % 400 == 0)
  6. return 1;
  7. else if (year % 100 == 0)
  8. return 0;
  9. else if (year % 4 == 0)
  10. return 1;
  11. else
  12. return 0;
  13. }
  14.  
  15.  
  16. int main()
  17. {
  18. int year;
  19.  
  20. while(1) {
  21. printf("Enter any year: ");
  22. scanf("%d", &year);
  23. if(isLeapYear(year)) {
  24. printf("%d is leap year!\n", year);
  25. }
  26. else {
  27. printf("%d is not leap year!\n", year);
  28. }
  29. }
  30.  
  31. return 0;
  32. }
Add Comment
Please, Sign In to add comment