Advertisement
meteor4o

#Java-Fund 02. English Name of the Last Digit

May 20th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Main {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6.  
  7. int numA = Integer.parseInt(sc.nextLine());
  8. int b = numA % 10;
  9.  
  10.  
  11. switch (b) {
  12. case 1:
  13. System.out.print("one");
  14. break;
  15. case 2:
  16. System.out.print("two");
  17. break;
  18. case 3:
  19. System.out.print("three");
  20. break;
  21. case 4:
  22. System.out.print("four");
  23. break;
  24. case 5:
  25. System.out.print("five");
  26. break;
  27. case 6:
  28. System.out.print("six");
  29. break;
  30. case 7:
  31. System.out.print("seven");
  32. break;
  33. case 8:
  34. System.out.print("eight");
  35. break;
  36. case 9:
  37. System.out.print("nine");
  38. break;
  39. case 0:
  40. System.out.print("zero");
  41. break;
  42. default:
  43. break;
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement