Advertisement
CR7CR7

task8

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