-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathif_else_statement_Assignment.java
More file actions
39 lines (34 loc) · 1.26 KB
/
Copy pathif_else_statement_Assignment.java
File metadata and controls
39 lines (34 loc) · 1.26 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
import java.util.Scanner;
public class if_else_statement_Assignment {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter the year of birth: ");
int YoB = input.nextInt();
if (YoB % 12 == 0) {
System.out.println("Year of Monkey");
} else if (YoB % 12 == 1) {
System.out.println("Year of Rooster");
} else if (YoB % 12 == 2) {
System.out.println("Year of Dog");
} else if (YoB % 12 == 3) {
System.out.println("Year of Pig");
} else if (YoB % 12 == 4) {
System.out.println("Year of Rat");
} else if (YoB % 12 == 5) {
System.out.println("Year of Ox");
} else if (YoB % 12 == 6) {
System.out.println("Year of Tiger");
} else if (YoB % 12 == 7) {
System.out.println("Year of Rabbit");
} else if (YoB % 12 == 8) {
System.out.println("Year of Dragon");
} else if (YoB % 12 == 9) {
System.out.println("Year of Snake");
} else if (YoB % 12 == 10) {
System.out.println("Year of Horse");
} else {
System.out.println("Year of Sheep");
}
input.close();
}
}