-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathif_elseHomework.java
More file actions
36 lines (28 loc) · 947 Bytes
/
if_elseHomework.java
File metadata and controls
36 lines (28 loc) · 947 Bytes
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
package Homework;
import java.util.Scanner;
public class if_elseHomework {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter please number of month: (1 = January, 2 = February, etc.)");
int month = sc.nextInt();
sc.close();
if (month < 3)
System.out.println("winter");
else if (month > 11)
System.out.println("winter");
else if (month == 3)
System.out.println("spring");
else if (month == 4)
System.out.println("spring");
else if (month == 5)
System.out.println("spring");
else if (month == 6)
System.out.println("summer");
else if (month == 7)
System.out.println("summer");
else if (month == 8)
System.out.println("summer");
else
System.out.println("autumn");
}
}