Find either a input year is leap year or not.



Click here to open this program in Turbo C++

/**********************************************************
 Statement - Prefect Leap Year
 Programmer - Vineet Choudhary
 Written For - http://developerinsider.in
 **********************************************************/

#include <stdio.h>
#include <conio.h>

void main()  
{
    int year;
    clrscr();

    printf("Enter the year : ");
    scanf("%d",&year);
    int temp=year/100;
    if(year%100==0)
    {
        if(temp%400==0)
        {
            printf("%d is leap year.",year);
        }
        else
        {
            printf("%d is ordinary year.",year);
        }
    }
    else
    {
        if(year%4==0)
        {
            printf("%d is leap year.",year);
        }
        else
        {
            printf("%d is ordinary year.",year);
        }
    }

    getch();
}