Search



Wednesday, 11 February 2015

Leap Year

In this program, to check the leap year, there is a Mathematical formula for that. Now, according to the formula, if else conditions and statements are used. After checking all the conditions respectively, the program will give output.


Program to check Leap Year.

#include<stdio.h>
#include<conio.h>
void main()
{ int a;
printf("\n program to check for leap year");
printf("\n\n enter year : ");
scanf("%d",&a);
if((a%400)==0)
{   printf("\n\n %d is a leap year",a);     }
else if((a%100)==0)
{ printf("\n\n it is not a leap year"); }
else if((a%4)==0)
{       printf("\n\n %d is a leap year",a);     }
else
{ printf("\n\n it is not a leap year"); }
getch();
}



No comments:

Post a Comment

Guys if you think something is wrong or should be edit than please do comment.