-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFun53.java
More file actions
42 lines (41 loc) · 1.48 KB
/
Fun53.java
File metadata and controls
42 lines (41 loc) · 1.48 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
package fun;
public class Fun53 {
public static void main(String[] args) {
MonthDay(2022,3);
}
public static void MonthDay(int y,int m) {
int b, c, f;
b = y % 100;//1300 = b ==> 00
c = y % 400;//1300-1200= c ==> 100
f = y % 4;
if ( b == 0 ) {
if ( c == 0 ) {
switch (m){
case 1,3,5,7,8,10,12-> System.out.println ((m=31)+" kun");
case 2-> System.out.println ((m=29)+" kun");
case 4,6,9,11-> System.out.println ((m=30)+" kun");
}
} else {
switch (m){
case 1,3,5,7,8,10,12-> System.out.println ((m=31)+" kun");
case 2-> System.out.println ((m=28)+" kun");
case 4,6,9,11-> System.out.println ((m=30)+" kun");
}
}
} else {
if ( f == 0 ) {
switch (m){
case 1,3,5,7,8,10,12-> System.out.println ((m=31)+" kun");
case 2-> System.out.println ((m=29)+" kun");
case 4,6,9,11-> System.out.println ((m=30)+" kun");
}
} else {
switch (m){
case 1,3,5,7,8,10,12-> System.out.println ((m=31)+" kun");
case 2-> System.out.println ((m=28)+" kun");
case 4,6,9,11-> System.out.println ((m=30)+" kun");
}
}
}
}
}