Previous
0 / 6
Module DEMO-32-57DEMO-C-32

Leap Year Classification

DEMO-C-32 β€’ Programming in C

Browser-only practice

Problem Statement

Problem Description

Write a program that determines whether a given year is a leap year or a common year.

Leap Year Rules

A year is a leap year if it satisfies the following conditions:

  • It is divisible by 4, and If it is divisible by 100, then it must also be divisible by 400 to be a leap year.
  • Otherwise (not divisible by 100), it is a leap year.

In simpler terms:

  1. If the year is divisible by 400 β†’ Leap Year
  2. Else if divisible by 100 β†’ Common Year
  3. Else if divisible by 4 β†’ Leap Year
  4. Otherwise β†’ Common Year

Example

  • 2024: Divisible by 4 but not 100 β†’ LEAP YEAR
  • 1900: Divisible by 100 but not 400 β†’ COMMON YEAR
  • 2000: Divisible by 400 β†’ LEAP YEAR

Constraints

The input must be a positive integer between 1 and 10000 inclusive. Your solution must correctly implement the leap year logic as described.

Input Format

A single integer representing the year.

  • Input: year (integer)
  • Range: 1 ≀ year ≀ 10000

Output Format

Print exactly one of the following strings on a single line:

  • LEAP YEAR if the year is a leap year
  • COMMON YEAR if the year is not a leap year

No extra spaces or formatting.

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
2024
LEAP YEAR
2024 is divisible by 4 but not by 100, so it's a leap year
Sample #2
Public sample
2000
LEAP YEAR
2000 is divisible by 400, so it's a leap year
Sample #3
Public sample
1900
COMMON YEAR
1900 is divisible by 100 but not by 400, so it's not a leap year
Sample #4
Public sample
2023
COMMON YEAR
2023 is not divisible by 4, so it's not a leap year
Sample #5
Public sample
10000
LEAP YEAR
10000 is divisible by 100 but not by 400, so it's not a leap year

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings