Advertisement
mstoyanova

digitAsWord

Feb 18th, 2021
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1. package com.Exam;
  2.  
  3. import java.util.InputMismatchException;
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class DigitAsALetter {
  8.     public static void main(String[] args) {
  9.  
  10.         Scanner scanner = new Scanner(System.in);
  11.  
  12.         int digit = scanner.nextInt();
  13.  
  14.  
  15.         switch (digit) {
  16.             case 0:
  17.                 System.out.println("zero");
  18.                 break;
  19.             case 1:
  20.                 System.out.println("one");
  21.                 break;
  22.             case 2:
  23.  
  24.                     System.out.println("two");
  25.                     break;
  26.             case 3:
  27.  
  28.                 System.out.println("three");
  29.                 break;
  30.             case 4:
  31.  
  32.                 System.out.println("four");
  33.                 break;
  34.             case 5:
  35.  
  36.                 System.out.println("five");
  37.                 break;
  38.  
  39.             case 6:
  40.  
  41.                 System.out.println("six");
  42.                 break;
  43.             case 7:
  44.  
  45.                 System.out.println("seven");
  46.                 break;
  47.             case 8:
  48.  
  49.                 System.out.println("eight");
  50.                 break;
  51.             case 9:
  52.                 System.out.println("nine");
  53.                 break;
  54.                
  55.             default:
  56.  
  57.                 System.out.println("not a digit");
  58.         }
  59.  
  60.         }
  61.  
  62.             }
  63.  
  64.  
  65.    
  66.  
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement