AIM:   Write a program to check whether the year is leap year or not

Eg. 2016: Leap Year

 

input:-

 

#include<stdio.h>

int main()

{

    int year;

    printf(“enter year=”);

    scanf(“%d”,&year);

    

    if(year%4==0)

    {

        if(year%100==0)

        {

            

            if(year%400==0)

            {

                printf(“%d year is leap year\n”,year);

            }

            else

            {

                printf(“%d year is not leap year\n”,year);

            }

        }

        else

        {

            printf(“%d year is leap year\n”,year);

        }

        

    }

    else

    {

        printf(“%d year is not leap year\n”,year);

    }

    

    return 0;

}

Output:-

enter year=2016

2016 year is leap year

Advertisements