Friday, 26 August 2016

Program to Check Leap Year

Program to Check Leap Year:

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

}

0 comments:

Post a Comment

if you have any doubt please let me know