C Program to Check if a Given Year is Leap Year



In this program we will check whether a given year is leap year or not. A year that has 366 days is called a leap year



  1. //C program to check leap year
  2. #include <stdio.h>
  3. int main()
  4. {
  5. int y;
  6. printf("Enter year: ");
  7. scanf("%d",&y);
  8. if(y % 4 == 0)
  9. {
  10. if( y % 100 == 0)
  11. {
  12. if ( y % 400 == 0)
  13. printf("%d is a Leap Year", y);
  14. else
  15. printf("%d is not a Leap Year", y);
  16. }
  17. else
  18. printf("%d is a Leap Year", y );
  19. }
  20. else
  21. printf("%d is not a Leap Year", y);
  22. return 0;
  23. }

Output
Output!
Please click on the like button if it worked

Solution not working or have any suggestions? Please send an email to [email protected]


Join Our Facebook Group


Share this example


Download Android App

download android app

Popular C Examples









codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube