import java.util.Scanner;
//查看属相
public class Experiment5 {
public static void main(String[] args) {
int a = 2020;
int b;
Scanner sc = new Scanner(System.in);
System.out.println("请输入您的出生年份");
b = sc.nextInt();
if ((a - b) % 12 == 0) {
System.out.println("您的属相为--子鼠");
} else if ((a + 1 - b) % 12 == 0) {
System.out.println("您的属相为--丑牛");
} else if ((a + 2 - b) % 12 == 0) {
System.out.println("您的属相为--寅虎");
} else if ((a + 3 - b) % 12 == 0) {
System.out.println("您的属相为--卯兔");
} else if ((a + 4 - b) % 12 == 0) {
System.out.println("您的属相为--辰龙");
} else if ((a + 5 - b) % 12 == 0) {
System.out.println("您的属相为--巳蛇");
} else if ((a + 6 - b) % 12 == 0) {
System.out.println("您的属相为--午马");
} else if ((a + 7 - b) % 12 == 0) {
System.out.println("您的属相为--未羊");
} else if ((a + 8 - b) % 12 == 0) {
System.out.println("您的属相为--申猴");
} else if ((a + 9 - b) % 12 == 0) {
System.out.println("您的属相为--酉鸡");
} else if ((a + 10 - b) % 12 == 0) {
System.out.println("您的属相为--戌狗");
} else if ((a + 11 - b) % 12 == 0) {
System.out.println("您的属相为--亥猪");
}
}
} |
|