Advertisement
Guest User

Untitled

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