Skip to main content

Program to Print Numbers to String

· One min read
Kaustubh Kulkarni

We are going to write Program to Print Numbers to String, which will print from 1 to 99,99,99,999.

You can also increase it's capacity by adding few cases in startPrint() method.

numberToWords.java
import java.util.ArrayList;
import java.util.Scanner;
import javax.lang.model.util.ElementScanner6;
import jdk.javadoc.internal.doclets.toolkit.util.DocFinder.Output;
public class numberToWords {
String[] singles={"","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen","Twenty"};
String[] tens={"","Ten","Twenty","Thirty","Fourty","Fifty","Sixty","Seventy","Eighty","Ninty","Hundered"};
String[] powers={"Hundred","Thousand","Lakh","Crore"};
ArrayList
![Program to Print Numbers to String](https://kaustubhk24.netlify.app/imgs/wp-content/uploads/2020/12/image-1.png)

Looking solution to use in Android ? [Checkout here](https://github.com/kaustubhk24/NumberToWords-Library)

Same Program in javaScript [Checkout here](https://blog.kaustubh.codes/program-to-print-numbers-to-string-in-javascript/)