Program to find whether given year is the leap year or not.
Program Code:
#include<stdio.h>
#include<conio.h>
int main()
{
int year;
clrscr();
printf("Enter valid year\n");
scanf("%d",&year);
if((year%4==0) && (year%100!=0) || (year%400 ==0)) //check for leap year
{
printf("%d is the leap year", year);
}
else
{
printf("%d is not a leap year",year);
}
getch();
}
Output:
Enter valid year
2012
2012 is the leap year
Post A Comment:
0 comments: