Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions LeapYear.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
public class LeapYear {
public static void main(String[] args) {
int year;
{
{ //create scanner object
Scanner sc = new Scanner(System.in);
System.out.println("Enter year to check: ");
year = sc.nextInt();

//check if its a leap year or not
if ((year % 4 == 0) && year % 100 != 0) {
//printing the result
System.out.println(year + " is a leap year.");
} else if ((year % 4 == 0) && (year % 100 == 0)
&& (year % 400 == 0)) {
Expand Down