Advertisement
GEORGI_ZAHARIEV

DigitAsWord

Jan 8th, 2022
65
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7. public static void main(String[] args) {
  8. // write your code here
  9. Scanner scanner = new Scanner(System.in);
  10. String n = scanner.nextLine();
  11.  
  12. switch(n) {
  13.  
  14. case "":
  15. break;
  16.  
  17. case "1":
  18. System.out.println("one");
  19. break;
  20.  
  21. case "2":
  22. System.out.println("two");
  23. break;
  24.  
  25. case "3":
  26. System.out.println("three");
  27. break;
  28.  
  29. case "4":
  30. System.out.println("four");
  31. break;
  32.  
  33. case "5":
  34. System.out.println("five");
  35. break;
  36.  
  37. case "6":
  38. System.out.println("six");
  39. break;
  40.  
  41. case "7":
  42. System.out.println("seven");
  43. break;
  44.  
  45. case "8":
  46. System.out.println("eight");
  47. break;
  48.  
  49. case "9":
  50. System.out.println("nine");
  51. break;
  52.  
  53. default:
  54. System.out.println("not a digit");
  55. break;
  56.  
  57. }
  58.  
  59. }
  60.  
  61. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement