martinvalchev

Number 0...100 to Text

Oct 23rd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 8.04 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Number0_100toText {
  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 if (a == 10) {
  27.                 System.out.println("ten");
  28.             } else if (a == 11) {
  29.                 System.out.println("eleven");
  30.             } else if (a == 12) {
  31.                 System.out.println("twelve");
  32.             } else if (a == 13) {
  33.                 System.out.println("thirteen");
  34.             } else if (a == 14) {
  35.                 System.out.println("fourteen");
  36.             } else if (a == 15) {
  37.                 System.out.println("fifteen");
  38.             } else if (a == 16) {
  39.                 System.out.println("sixteen");
  40.             } else if (a == 17) {
  41.                 System.out.println("seventeen");
  42.             } else if (a == 18) {
  43.             System.out.println("eighteen");
  44.         }  else if (a == 19) {
  45.             System.out.println("nineteen");
  46.         } else if (a == 20) {
  47.             System.out.println("twenty");
  48.         } else if (a == 21) {
  49.             System.out.println("twenty one");
  50.         } else if (a == 22) {
  51.             System.out.println("twenty two");
  52.         } else if (a == 23) {
  53.             System.out.println("twenty three");
  54.         } else if (a == 24) {
  55.             System.out.println("twenty four");
  56.         } else if (a == 25) {
  57.             System.out.println("twenty five");
  58.         } else if (a == 26) {
  59.             System.out.println("twenty six");
  60.         } else if (a == 27) {
  61.             System.out.println("twenty seven");
  62.         } else if (a == 28) {
  63.             System.out.println("twenty eight");
  64.         } else if (a == 29) {
  65.             System.out.println("twenty nine");
  66.         } else if (a == 30) {
  67.             System.out.println("thirty");
  68.         } else if (a == 31) {
  69.             System.out.println("thirty one");
  70.         } else if (a == 32) {
  71.             System.out.println("thirty two");
  72.         } else if (a == 33) {
  73.             System.out.println("thirty three");
  74.         } else if (a == 34) {
  75.             System.out.println("thirty four");
  76.         } else if (a == 35) {
  77.             System.out.println("thirty five");
  78.         } else if (a == 36) {
  79.             System.out.println("thirty six");
  80.         } else if (a == 37) {
  81.             System.out.println("thirty seven");
  82.         } else if (a == 38) {
  83.             System.out.println("thirty eight");
  84.         } else if (a == 39) {
  85.             System.out.println("thirty nine");
  86.         } else if (a == 40) {
  87.             System.out.println("forty");
  88.         } else if (a == 41) {
  89.             System.out.println("forty one");
  90.         } else if (a == 42) {
  91.             System.out.println("forty two");
  92.         } else if (a == 43) {
  93.             System.out.println("forty three");
  94.         } else if (a == 44) {
  95.             System.out.println("forty four");
  96.         } else if (a == 45) {
  97.             System.out.println("forty five");
  98.         } else if (a == 46) {
  99.             System.out.println("forty six");
  100.         } else if (a == 47) {
  101.             System.out.println("forty seven");
  102.         } else if (a == 48) {
  103.             System.out.println("forty eight");
  104.         } else if (a == 49) {
  105.             System.out.println("forty nine");
  106.         } else if (a == 50) {
  107.             System.out.println("fifty");
  108.         } else if (a == 51) {
  109.             System.out.println("fifty one");
  110.         } else if (a == 52) {
  111.             System.out.println("fifty two");
  112.         } else if (a == 53) {
  113.             System.out.println("fifty three");
  114.         } else if (a == 54) {
  115.             System.out.println("fifty four");
  116.         } else if (a == 55) {
  117.             System.out.println("fifty five");
  118.         } else if (a == 56) {
  119.             System.out.println("fifty six");
  120.         } else if (a == 57) {
  121.             System.out.println("fifty seven");
  122.         } else if (a == 58) {
  123.             System.out.println("fifty eight");
  124.         } else if (a == 59) {
  125.             System.out.println("fifty nine");
  126.         } else if (a == 60) {
  127.             System.out.println("sixty");
  128.         } else if (a == 61) {
  129.             System.out.println("sixty one");
  130.         } else if (a == 62) {
  131.             System.out.println("sixty two");
  132.         } else if (a == 63) {
  133.             System.out.println("sixty three");
  134.         } else if (a == 64) {
  135.             System.out.println("sixty four");
  136.         } else if (a == 65) {
  137.             System.out.println("sixty five");
  138.         } else if (a == 66) {
  139.             System.out.println("sixty six");
  140.         } else if (a == 67) {
  141.             System.out.println("sixty seven");
  142.         } else if (a == 68) {
  143.             System.out.println("sixty eight");
  144.         } else if (a == 69) {
  145.             System.out.println("sixty nine");
  146.         } else if (a == 70) {
  147.             System.out.println("seventy");
  148.         } else if (a == 71) {
  149.             System.out.println("seventy one");
  150.         } else if (a == 72) {
  151.             System.out.println("seventy two");
  152.         } else if (a == 73) {
  153.             System.out.println("seventy three");
  154.         } else if (a == 74) {
  155.             System.out.println("seventy four");
  156.         } else if (a == 75) {
  157.             System.out.println("seventy five");
  158.         } else if (a == 76) {
  159.             System.out.println("seventy six");
  160.         } else if (a == 77) {
  161.             System.out.println("seventy seven");
  162.         } else if (a == 78) {
  163.             System.out.println("seventy eight");
  164.         } else if (a == 79) {
  165.             System.out.println("seventy nine");
  166.         } else if (a == 80) {
  167.             System.out.println("eighty");
  168.         } else if (a == 81) {
  169.             System.out.println("eighty one");
  170.         } else if (a == 82) {
  171.             System.out.println("eighty two");
  172.         } else if (a == 83) {
  173.             System.out.println("eighty three");
  174.         } else if (a == 84) {
  175.             System.out.println("eighty four");
  176.         } else if (a == 85) {
  177.             System.out.println("eighty five");
  178.         } else if (a == 86) {
  179.             System.out.println("eighty six");
  180.         } else if (a == 87) {
  181.             System.out.println("eighty seven");
  182.         } else if (a == 88) {
  183.             System.out.println("eighty eight");
  184.         } else if (a == 89) {
  185.             System.out.println("eighty nine");
  186.         } else if (a == 90) {
  187.             System.out.println("ninety");
  188.         } else if (a == 91) {
  189.             System.out.println("ninety one");
  190.         } else if (a == 92) {
  191.             System.out.println("ninety two");
  192.         } else if (a == 93) {
  193.             System.out.println("ninety three");
  194.         } else if (a == 94) {
  195.             System.out.println("ninety four");
  196.         } else if (a == 95) {
  197.             System.out.println("ninety five");
  198.         } else if (a == 96) {
  199.             System.out.println("ninety six");
  200.         } else if (a == 97) {
  201.             System.out.println("ninety seven");
  202.         } else if (a == 98) {
  203.             System.out.println("ninety eight");
  204.         } else if (a == 99) {
  205.             System.out.println("ninety nine");
  206.         } else if (a == 100) {
  207.             System.out.println("one hundred");
  208.         } else if (a == 0) {
  209.             System.out.println("zero");
  210.         } else {
  211.             System.out.println("invalid number");
  212.         }
  213.  
  214.         }
  215. }
Advertisement
Add Comment
Please, Sign In to add comment