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
- C Program To Append Data Into A File
- C Program to Accept Only Integer Values
- C Program To Arrange Numbers In Descending Order
- C Program to Add Days to Date
- C Program to Add Two Fractions
- C Program To Reverse A Number
- C Program to Find Maximum and Minimum Numbers
- C Program to Read a Text File
- C Program to Convert Decimal to Hexadecimal
- C Program to Convert Decimal to Binary
- C Program to Convert Celsius to Fahrenheit
- C Program To Find Absolute Value
- Ternary Operator Program in C
- C Program For Addition Table Using For Loop
- Denomination Program in C
- C Program to Print Multiplication Table
- C Program Array with Example
- Binary Search in C Program Using Recursion
- Bubble Sort in C Using Pointers
- Bubble Sort Program in C Using Recursion