-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathswitch9.java
More file actions
64 lines (53 loc) · 1.15 KB
/
switch9.java
File metadata and controls
64 lines (53 loc) · 1.15 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
52
53
54
55
56
57
58
59
60
61
62
63
64
package swichcase;
import java.util.Scanner;
public class switch9 {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
function(31,1);
}
public static void function(int day, int month) {
switch (month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
if (day == 31)
{
day = 0;
}
break;
case 4:
case 6:
case 9:
case 11:
if (day == 30)
{
day = 0;
}
break;
case 2:
if (day == 28)
{
day = 0;
}
break;
}
if (day == 0)
{
if (month== 12)
{
month = 1;
}
else
{
month++;
}
}
day++;
System.out.printf("Natija : %d.%d\n",day,month);
}
}