import java.util.Scanner ;
public class Task4 {
public static void main (String[] args) {
Scanner input = new Scanner ( System.in ) ;
int year =0;
do{
System.out.print ( "Enter year : ") ;
year = input.nextInt() ;
}while (year<500);
Leap(year);
}
public static void Leap (int year){
if(year%100==0){
if(year%400==0&&year%4==0){
System.out.println ( "Century Leap year ") ;
}else{
System.out.println ( "Not a Leap year ") ;
}
}else{
if(year%4==0){
System.out.println ( "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