Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
26 lines (22 loc) · 805 Bytes

File metadata and controls

executable file
·
26 lines (22 loc) · 805 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//**************************************************************
// LeapYear.java
//
// Asks user for a year and checks to see if it is a leap year.
//**************************************************************
import java.util.Scanner;
public class LeapYear
{
public static void main(String args[])
{
int year;
Scanner scan = new Scanner(System.in);
System.out.print("Enter a year XXXX : ");
year = scan.nextInt();
if (year < 1582)
System.out.println("The Gregorian calender was apoted in 1582. Year must not be less than 1582.");
else if ( (year % 400 == 0) || ( (year % 4 == 0) && (year % 100 != 0) ) )
System.out.println("" + year + " is a leap year");
else
System.out.println(year + " is NOT a leap year");
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.