Friday, July 10, 2015

Leap year by function

#include<stdio.h>

int main()
{
    int a,year;
    year=leap_year(a);
    if(((year%4==0)&&(year%100!=0))||(year%400==0))

        printf("%d is a leap year",year);
    else
        printf("%d is not a leap year",year);

    return 0;
}


int leap_year(int year)
{


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


}

No comments:

Post a Comment