Skip to content

A simple Java program that checks if a given year is a leap year based on standard leap year rules. Accepts user input and outputs whether the year is a leap year or not.

Notifications You must be signed in to change notification settings

Mooyi07/LeapYear

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Leap Year Checker

πŸ“Œ Description

This Java program determines whether a given year is a leap year or not. The user inputs a year, and the program evaluates it using the standard leap year conditions.

πŸ›  Features

  • Accepts a year as user input.
  • Checks whether the year is a leap year based on:
    • Divisibility by 4.
    • Not divisible by 100, unless also divisible by 400.
  • Displays whether the year is a leap year or not.

πŸ“‚ File Structure

  • Main.java – Contains the implementation for the leap year checker.

πŸš€ Usage

  1. Compile the Java file:
    javac Main.java
  2. Run the program:
    java Main
  3. Enter a year when prompted:
    Enter year: 2024
    
  4. Example Output:
    This is a leap year
    
    Enter year: 2023
    This is not a leap year
    

πŸ“ Explanation

  1. The user enters a year.
  2. The program checks if:
    • The year is divisible by 4 but not by 100 (unless also divisible by 400).
    • If the condition is met, it prints β€œThis is a leap year”.
    • Otherwise, it prints β€œThis is not a leap year”.

πŸ“œ License

This project is open-source and free to use.

About

A simple Java program that checks if a given year is a leap year based on standard leap year rules. Accepts user input and outputs whether the year is a leap year or not.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages