178k views
10 votes
Plzz help me plzzz help me
its very important​


plzzz..........

Plzz help me plzzz help me its very important​ plzzz..........-example-1
User Flauwekeul
by
3.0k points

1 Answer

9 votes

Answer:

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

while (true) {

System.out.print("Enter a year (0 to exit): ");

int year = scan.nextInt();

if (year == 0) break;

boolean leap = false;

if (year % 4 == 0) {

if (year % 100 == 0) {

leap = (year % 400 == 0);

}

else {

leap = true;

}

}

System.out.printf("%d is%s a leap year.\\", year, leap ? "":" not");

}

}

}

User Kazhiu
by
3.7k points