Skip to content

Commit

Permalink
Lear Year in Java
Browse files Browse the repository at this point in the history
- Shortest Code for Leap year in Java.  
- Fastest Execution.
  • Loading branch information
Ashutosh-Ray authored Oct 3, 2022
1 parent 8547d21 commit 0ba2412
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions leapYear.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import java.util.*;
public class leapYear {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
String res= (a%400==0) || (a%4==0 && a%100!=0) ? "Leap Year" : "Not a Leap Year";
System.out.println(res);
sc.close();
}
}

0 comments on commit 0ba2412

Please sign in to comment.