-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay-03-Java-Q15
More file actions
51 lines (35 loc) · 1.38 KB
/
Copy pathDay-03-Java-Q15
File metadata and controls
51 lines (35 loc) · 1.38 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*Deepak wants to know how to find whether the year is leap year or not.could you please help him to find the year is leap year or not. - A century year is a year ending with 00. A century year is a leap year only if it is divisible by 400. - A leap year (except a century year) can be identified if it is exactly divisible by 4. - A century year should be divisible by 4 and 100 both. - A non-century year should be divisible only by 4.
Input Format
input consists of integer
Constraints
No Constraints
Output Format
execute the statemene whether the given year is leap or not.
Sample Input 0
1900
Sample Output 0
The Given Year 1900 is Not a Leap Year.
Sample Input 1
2000
Sample Output 1
The Given Year 2000 is a Leap Year.
Sample Input 2
2015
Sample Output 2
The Given Year 2015 is Not a Leap Year.*/
#Answer
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n = sc.nextInt();
if ((n % 400 == 0) || (n % 4 == 0 && n % 100 != 0)) {
System.out.println("The Given Year " + n + " is a Leap Year.");
} else {
System.out.println("The Given Year " + n + " is Not a Leap Year.");
}
sc.close();
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
}
}