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

Get a year and check whether year is leap year or not.

sample Input 1:

2016

Sample Output 1:

Leap year

Sample Input 2:

2017

Sample Output 2:

Not Leap Year

Program or 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;
}
			
				
			

Program 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.

Comments

santhoshokk
I want a flow chart explanation for the program that is easy to understand