import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter Your Year : "); int n = in.nextInt(); if(n%100==0){ if(n%400==0){ System.out.println("Its Leap/Century Year"); } else{ System.out.println("Not a Leap year"); } }else if(n%4==0){ System.out.println("Its a Leap Year"); } else{ System.out.println("Not a leap year"); } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter