C Program To Find Leap Year

C Program To Find Leap Year. If you are looking for checking leap year program in C, here in this tutorial we will help you to learn how to write a C program to check if a given year is leap year.

C Program To Find Leap Year

Learn how to write a C program to find leap year. Writing C Program to check if a given year is leap year can be done using various techniques but here in this program, we show how to write a C program to find if a given year is a leap year in a proper way.

C Program to Check Leap Year Source Code

Just copy paste the below source code to check whether a given year is leap or not in C compiler to test, how the source code works. Happy Learning.

/* C Program to Find Leap Year - LeapYear.C */

#include <stdio.h>
void main()
{
 int year; //variable declaration
 
 printf("Enter a year \n");
 scanf("%d", &year);
 
 //checking whether a year is leap year or not
 if ((year % 400) == 0)
 printf("%d is a leap year \n", year);

 else if ((year % 100) == 0)
 printf("%d is a not leap year \n", year);

 else if ((year % 4) == 0)
 printf("%d is a leap year \n", year);

 else
 printf("%d is not a leap year \n", year);
}

Checking Leap Year Using C Program Output

Run the above leap year program to check if a given year is leap year or not. For this enter a year to check, the c compiler will execute the logic and display whether the enteted year is leap year or not.

Output:

Enter a year
2020
2020 is a leap year

Enter a year
2017
2017 is not a leap year

C PROGRAMMING EXAMPLES

  1. C Program To Append Data Into A File
  2. C Program to Accept Only Integer Values
  3. C Program To Arrange Numbers In Descending Order
  4. C Program to Add Days to Date
  5. C Program to Add Two Fractions
  6. C Program To Reverse A Number
  7. C Program to Find Maximum and Minimum Numbers
  8. C Program to Read a Text File
  9. C Program to Convert Decimal to Hexadecimal
  10. C Program to Convert Decimal to Binary
  11. C Program to Convert Celsius to Fahrenheit
  12. C Program To Find Absolute Value
  13. Ternary Operator Program in C
  14. C Program For Addition Table Using For Loop
  15. Denomination Program in C
  16. C Program to Print Multiplication Table 
  17. C Program Array with Example
  18. Binary Search in C Program Using Recursion
  19. Bubble Sort in C Using Pointers
  20. Bubble Sort Program in C Using Recursion

Leave a Comment