Untitled
// Write a Java program that takes a year from the user and print whether that year is a leap year or not. import java.util.*; public class Question_5 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Welcome to leapYear Station"); int year = sc.nextInt(); if (year % 400 == 0){ if(year % 100 == 0){ if (year % 4 == 0){ System.out.println("This is leapYear"); }else { System.out.println("This is not a leapYear"); } }else{ System.out.println("This is a not leapYear"); } }else{ System.out.println("This is not a leapYear"); } } }
Leave a Comment