Find leap year

Algorithm

Input	An year 
Output	Leap year or not
complexity O(1).

leapyear(year)
1 If (year %4==0 and year%100 !=0)
2    print "it is a leap year";
3 else
4 if(year%400==0)
5    print "it is a leap year";
6 else
7    print "it is not a leap year";

Algorithm Description


C Code

//Find that the year entered is Leap year or not
//Input : Any positive Integer

#include< stdio.h>
#include< conio.h>
int main()
{
    int year;
    printf("Enter a year ");
    scanf("%d",&year);
    if((year % 4==0) && (year%100!=0))
	    printf("Year entered is a leap year");
    else
    if (year%400==0)
           printf("Year entered is a leap year");
    else
	    printf("Year entered is not a leap year");
}