forked from seeditsolution/javaprogram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleap year
32 lines (28 loc) · 764 Bytes
/
leap year
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
Java program to check
// for a leap year
class Test
{
static boolean checkYear(int year)
{
// If a year is multiple of 400,
// then it is a leap year
if (year % 400 == 0)
return true;
// Else If a year is muliplt of 100,
// then it is not a leap year
if (year % 100 == 0)
return false;
// Else If a year is muliplt of 4,
// then it is a leap year
if (year % 4 == 0)
return true;
return false;
}
// Driver method
public static void main(String[] args)
{
int year = 2000;
System.out.println( checkYear(2000)? "Leap Year" :
"Not a Leap Year" );
}
}