How to find that given year is a leap year

Program

#include<stdio.h>
void main(void)
{
        int year;
printf("\n Enter a Year that you want to find it is a leap year:");
        scanf("%d",&year);
        if(year%100)
        printf("\n %d is a leap year",year);
        else if(year%400)
        printf("\n %d is a leap year",year);
        else if(year%4)
        printf("\n %d is a leap year",year);
        else
        printf("\n %d is a not leap year",year);
}

Output

Enter a Year that you want to find it is a leap year:2015
 2015 is a leap year

Comments

Popular posts from this blog

Stack

EXTRA INFORMATION ABOUT TECHNOLOGY