C Function to determine whether the year is a leap year or not.Any year is entered through the keyboard.

//C Function to determine whether the year is a leap year or not.Any year is entered through the keyboard.


#include <stdio.h>

int find(int a);

int main()
{
	int year,leap;
	printf("Enter an year : ");
	scanf("%d",&year);
	leap=find(year);
	if(leap==1)
		printf("%d year is leap year ",year);
	else
		printf("%d year is not a leap year ",year);

	return 0;
}

int find(int a)
{
	int i=0;
	if((a % 4 && a % 100 && a % 400)==0)
		i=1;
	else
		i=0;
	return i;
}

Output :
Enter an year : 2016

2016 year is leap year



Leave a comment