Become Our Fan on Social Sites!

Facebook Twitter

Google+ RSS YouTube

Friday 27 September 2013

Program to check a year is a leap year or not

C Program to check that given year is leap year or not in C language



#include<stdio.h>

int main()
{
    int year;

    printf("Enter year : ");
    scanf("%d",&year);

    if( ( (year % 4 == 0) && (year % 100 != 0) ) || (year % 400 == 0) )
        printf("%d is a leap year",year);
    else
        printf("%d is a ordinary year",year);

    return 0;
}

0 comments :

Post a Comment