File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* Title : Check whether the year entered is leap or not .
2
+ If the entered year passes the conditions then it is considered to be as leap
3
+ otherwise not .
4
+
5
+ */
6
+ import java .util .Scanner ;
7
+ class leap
8
+ { int leap_year ;
9
+
10
+ leap (int a ) // Constructor
11
+ {
12
+ leap_year =a ;
13
+ }
14
+ void check ()
15
+ {
16
+ if (leap_year %4 ==0 )
17
+
18
+ {
19
+ if (leap_year %100 ==0 )
20
+ {
21
+ if (leap_year %400 ==0 )
22
+ { System .out .println ( " Leap year ." );
23
+ System .out .println ( " \n 366 days in " +leap_year + " year . \n 29 days in month of Feb . \n " ); }
24
+ else
25
+ {
26
+ System .out .println ( " Not Leap year " ); }
27
+ }
28
+ else
29
+ { System .out .println ( " Leap year ." );
30
+ System .out .println ( " \n 366 days in " + leap_year + " year . \n 29 days in month of Feb . \n " );}
31
+ }
32
+
33
+ else
34
+ { System .out .println ( " Not Leap year " ); }
35
+
36
+ }
37
+
38
+ public static void main (String [] args )
39
+ {
40
+ int year ;
41
+ Scanner in =new Scanner (System .in );
42
+ year =in .nextInt ();
43
+ leap Y = new leap (year );
44
+ Y .check ();
45
+
46
+ }
47
+ }
48
+ /*
49
+ 1900
50
+ Not Leap year .
51
+
52
+ 2000
53
+ Leap year .
54
+
55
+ 366 days in year 2000 .
56
+ 29 days in month of Feb .
57
+
58
+ */
You can’t perform that action at this time.
0 commit comments