Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Test {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int num = Integer.parseInt(scanner.nextLine());
- lastDigit(num);
- }
- public static void lastDigit (int num) {
- int number = (num);
- int lastDigit = number % 10;
- if (lastDigit == 1){
- System.out.println("One");
- } else if (lastDigit == 2) {
- System.out.println("Two");
- } else if (lastDigit == 3) {
- System.out.println("Three");
- } else if (lastDigit == 5) {
- System.out.println("Five");
- } else if (lastDigit == 6) {
- System.out.println("Six");
- } else if (lastDigit == 7) {
- System.out.println("Seven");
- } else if (lastDigit == 8) {
- System.out.println("Eight");
- } else if (lastDigit == 9) {
- System.out.println("Nine");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement