This program takes a year as input and find whether a given year is leap year or not.
1. Take a year as input.
2. Check whether a given year is divisible by 400.
3. Check whether a given year is divisible by 100.
4. Check whether a given year is divisible by 4.
5. If the condition at step 2 and 4 becomes true, then the year is a leap year.
6. If the condition at step 3 becomes true, then the year is not a leap year.
Here is source code of the c program to check whether a year is leap year or not. The C program is successfully compiled and run on a Linux system. you can check and run the code in the compiler here and verify the code working. Also you can check the output below the code
printf("enter a year= ");
printf("%d is a leap year",year);
printf("year is not a leap year",year);
Enter a year: 1901 1901 is not a leap year.
Enter a year: 2016 2016 is a leap year.
live demo :- download code : –
Check out these related examples:
C Program to Check Armstrong Number