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