Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.1 kB
2
Indexable
Never
class NumberToWordExample1 {

    static void numberToWords(char num[]) {
        int len=5;
        if (len == 0) {

            System.out.println("The string is empty.");
            return;
        }

        if (len > 4) {

            System.out.println("\n The given number has more than 4 digits.");
            return;
        }

        String[] onedigit = new String[] { "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight",
                "Nine" };

        String[] twodigits = new String[] { "", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen",
                "Seventeen", "Eighteen", "Nineteen" };

        String[] multipleoftens = new String[] { "", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy",
                "Eighty", "Ninety" };

        String[] poweroftens = new String[] { "Hundred", "Thousand" };

        System.out.println(": ");

        if (len == 1) {
            System.out.println(1);
            onedigit[1]="";
            return;
        }
        int x = 0;
        return ;
        }
}