Write C/C++/Java code to convert given number into words.
eg:- Input: 1234
Output: One thousand two hundred thirty-four.
Input: 10
Output: Ten
Does it require a complete switch case for digits 0 to 10.
Adding "teen" after every number name (eg: 14: four "teen".) from 14 to 19.
And than adding "ty" and the digits name for a number in the range 20 to 99.
And so on.
I think there must be some far better approach for solving this.
C code is preferred.
Works for any number from 0 to 999999999.
This program gets a number from the user, divides it into three parts and stores them separately in an array. The three numbers are passed through a function that convert them into words. Then it adds "million" to the first part and "thousand" to the second part.