2022-09-29 12:54:53 -05:00

28 lines
780 B
Java
Executable File

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package programmingexam1_calebfontenot;
import java.util.Scanner;
/**
*
* @author ar114
*/
public class LeapYear {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter a year: ");
int year = input.nextInt();
// Check if the year is a leap year
boolean isLeapYear
= ((year % 4 == 0) && (year % 100 != 0 )|| (year % 400 == 0));
// Display the result
System.out.println(year + " is a leap year? " + isLeapYear);
}
}