C Program to find whether the given year is leap year or not

Description

Get a year and check whether year is leap year or not.
Input:
2016
Ouput:
Leap year
Input:
2017
Ouput
Not Leap Year

Solution

#include<stdio.h>
int main()
{
	int year;
	printf("Enter a year:");
	scanf("%d"&year);
	if(year%4==0)
	{
		printf("%d is leap year",year);
	}
	else
	{
		printf("%d is not leap year",year);
	}
	return 0;
}

Explanation

Get input year from user using scanf statement

check whether the remainder of year divided by 4 is equal to 0 using if statement.

if it is 0, then print year is leap year using printf statement. Else print year is not leap year using printf statement.