Advertisement
martinvalchev

Number0..9 to Text

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