Search⌘ K

Example 11: Check if a Given Year Is a Leap Year

Explore how to implement decision-making logic in C to check leap years. Understand the rules that define leap years and learn to write a program that outputs whether a year is leap or not, enhancing your control flow skills.

We'll cover the following...

Problem

Write a program that takes a year as an input and decides and then prints whether it is a leap year or not.

You should print the output on the console in the following manner:

  • Leap year
  • Not a leap year
...