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
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: