Java Program Number to Word
In this section, we will create a Java program that converts the given number into words. For example, if the given number is 54,297 then the output should be Fifty-Four Thousand Two Hundred Ninety-Seven. Let's create a Java program for the same.
The number is not limited to four digits. Then what if the user enters more than 5 five digits numbers. The above program does not work for large digit numbers.
Converting Large Numbers into Words
The logic for converting the large digit numbers is quite different. Let's see the approach to convert large digits numbers.
Converting Very Long Numbers into Words
The logic for the conversion of very long numbers into words is different from the previous one. Before moving ahead, it is important to learn the name of large numbers. The following table describes the name of the larger numbers.
Let's create a Java program that converts very long numbers into words.
The following Java program also converts the negative and decimal numbers into words.
0 = zero 4 = four 10 = ten 12 = twelve 100 = one hundred 108 = one hundred eight 299 = two hundred ninety-nine 1000 = one thousand 1003 = one thousand three 2040 = two thousand forty 45213 = forty-five thousand two hundred thirteen 100000 = one hundred thousand 100005 = one hundred thousand five 100010 = one hundred thousand ten 202020 = two hundred two thousand twenty 202022 = two hundred two thousand twenty-two 999999 = nine hundred ninety-nine thousand nine hundred ninety-nine 1000000 = one million 1000001 = one million one 10000000 = ten million 10000007 = ten million seven 99999999 = ninety-nine million nine hundred ninety-nine thousand nine hundred ninety-nine 9223372036854775807 = nine quintillion two hundred twenty-three quadrillion three hundred seventy-two trillion thirty-six billion eight hundred fifty-four million seven hundred seventy-five thousand eight hundred seven -9223372036854775808 = minus nine quintillion two hundred twenty-three quadrillion three hundred seventy-two trillion thirty-six billion eight hundred fifty-four million seven hundred seventy-five thousand eight hundred eight 0001.2 = one and two tenth 3.141592 = three and one hundred forty-one thousand five hundred ninety-two millionth
Even, we can convert 100 digits long number with the help of the above program.