leap year or not program in java using if else

Solutions on MaxInterview for leap year or not program in java using if else by the best coders in the world

showing results for - "leap year or not program in java using if else"
Elaina
12 May 2017
1import java.util.Scanner;public class Main{public static void main(String[] args){int year;System.out.println("Enter the year");Scanner sc = new Scanner(System.in);year = sc.nextInt();if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0))System.out.println("it is a leap year");elseSystem.out.println("it is not a leap year");}}