It’s a leap year C program that inputs any year from the user, then use leap year condition to check entered year leap or not, and print result on the screen.
To understand this program, it’s better you should know the following topics:
Program (1): to check that entered year is leap year or not.
#include<stdio.h> #include<conio.h> void main(void) { int yr; printf("Enter any year : "); scanf("%d", &yr); //condition for leap year if((yr%400==0)||(yr%100!=0&&yr%4==0)) { printf("%d is leap year\n", yr); } else { printf("%d is not leap year\n", yr); } getch(); }
Output (1)
Enter any year : 2008 2008 is leap year