Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class App {
- static int getMax(int a, int b) {
- return (a > b) ? a : b;
- }
- static int getMin(int a, int b) {
- return (a > b) ? b : a;
- }
- static void printMax(int a, int b) {
- int max = (a > b) ? a : b;
- System.out.println(max);
- }
- static String lastDigit(int number) {
- int last = number % 10;
- String text = "";
- switch (last) {
- case 0:
- text = "zero";
- break;
- case 1:
- text = "one";
- break;
- case 2:
- text = "two";
- break;
- case 3:
- text = "three";
- break;
- case 4:
- text = "four";
- break;
- case 5:
- text = "five";
- break;
- case 6:
- text = "six";
- break;
- case 7:
- text = "seven";
- break;
- case 8:
- text = "eight";
- break;
- case 9:
- text = "nine";
- break;
- }
- return text;
- }
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int num = scan.nextInt();
- String digit = lastDigit(num);
- System.out.println(digit);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement