veronikaaa86

[Java] 05. Number 0 to 9 to Text

Sep 22nd, 2017
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Number0to9toText {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int num = Integer.parseInt(scanner.nextLine());
  8.  
  9.         if (num == 0) {
  10.             System.out.println("zero");
  11.         } else if (num == 1) {
  12.             System.out.println("one");
  13.         } else if (num == 2) {
  14.             System.out.println("two");
  15.         } else if (num == 3) {
  16.             System.out.println("three");
  17.         } else if (num == 4) {
  18.             System.out.println("four");
  19.         } else if (num == 5) {
  20.             System.out.println("five");
  21.         } else if (num == 6) {
  22.             System.out.println("six");
  23.         } else if (num == 7) {
  24.             System.out.println("seven");
  25.         } else if (num == 8) {
  26.             System.out.println("eight");
  27.         } else if (num == 9) {
  28.             System.out.println("nine");
  29.         } else {
  30.             System.out.println("number too big");
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment