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!