sunfresh

Digit as Word

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