Decode School

Decode School - The School for Problem Solvers
Need Assignment / Project Guidance (or) Training in Python?

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:


Sample Output 1:

Leap year

Sample Input 2:


Sample Output 2:

Not Leap Year

Program or Solution

int main()
	int year;
	printf("Enter a year:");
		printf("%d is leap year",year);
		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.