Convert number to words java - GoHired
Write a code to Convert number to words . example ip 15 op : fifteen
ip : 1234 op : one thousand and thirty four
Algorithm : When we detect a number at any place how to convert to a word. Obviously we need to store it.
See usage of Data Structure in java and Data Structure in c++ .
See usage of static string in java.
Step 1 ) Create array of ones[20] = {"zero", "one", "two", …, "nineteen"};
Step 2) Create array of tens[10] = {"", "ten", "twenty", …, "ninety"};
Step 3) Divide number by 1000, 100, 20 and convert it.
Step 4) Print it.
Read full article from Convert number to words java - GoHired
No comments:
Post a Comment