Skip to content

Commit 0d366f0

Browse files
authored
Add files via upload
1 parent 61d3432 commit 0d366f0

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Leap_year.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import java.util.*;
2+
class A
3+
{
4+
public int year;
5+
6+
public void get_in()
7+
{
8+
System.out.println("Enter an Year :: ");
9+
Scanner sc = new Scanner(System.in);
10+
year = sc.nextInt();
11+
}
12+
}
13+
14+
class B extends A
15+
{
16+
public void print_out()
17+
{
18+
if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0))
19+
System.out.println("Specified year is a leap year");
20+
else
21+
System.out.println("Specified year is not a leap year");
22+
}
23+
}
24+
public class Leap_year
25+
{
26+
public static void main(String[] args)
27+
{
28+
B b = new B();
29+
b.get_in();
30+
b.print_out();
31+
}
32+
}

0 commit comments

Comments
 (0)