Share your repls and programming experiences

← Back to all posts
Leap year or not program in java using if-else
RaghunathThilag (1)

Write a leap year or not program in java using if-else. This software, written in the Java programming language, will show whether the year is a leap year or not. This bundle contains a set of basic Java programmes for beginners. There are 366 days in a year, with an intercalary day on February 29th every four years.

import java.util.Scanner;
public class Main
public static void main(String[] args)
int year;
System.out.println("Enter the year");
Scanner sc = new Scanner(;
year = sc.nextInt();
if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0))
System.out.println("it is a leap year");
System.out.println("it is not a leap year");
it is not a leap year

Link :