Translate

Thursday, June 4, 2015

C programming code for leap year.



#include<stdio.h>

void main()
{
    int year;

    printf("Enter a 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 not a leap year", year);

    return 0;
}

Download source code

0 comments:

Post a Comment