Created
January 16, 2016 19:18
-
-
Save chyiiiiiiiiiiii/6f99d05243250bdee04b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
String animal[] = { "tiger", "rabbit", "dragon", "snake", "horse", "sheep", "monkey", "rooster", "dog", "pig","rat", "ox" }; | |
int year = input.nextInt(); | |
if (year >= 2010) { | |
int number = year - 2010; | |
System.out.println(animal[number % 12]); | |
} else { | |
int number = 2010 - year; | |
if (number == 12) | |
System.out.println(animal[number % 12]); | |
else { | |
System.out.println(animal[12 - number % 12]); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment