Navigation

Saturday, 28 February 2015

Check whether the given year is leap year or not

I have write a simple program For Checking whether the given year is leap year or not.

void main()
{
    int yr;
    clrscr();
    printf("Program For Checking whether the given year is leap year or not\n");
    printf("Enter Year::");
    scanf("%d",&yr);
    if((yr%400==0)||(yr%100!=0 && yr%4==0))
    {
        printf("%d year is leap year",yr);

    }
    else
    {
        printf("%d year is non leap year",yr);
    }
    getch();
}

No comments:

Post a Comment