Guest User

Untitled

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