<p>Is there an efficient method of converting an integer into the written numbers, for example:</p>

<pre><code>string Written = IntegerToWritten(21);
</code></pre>

<p>would return "Twenty One".</p>

<p>Is there any way of doing this that doesn't involve a massive look-up table?</p>

[{'answer_id': 3215, 'author': 'lubos hasko', 'author_id': 275, 'author_profile': 'https://Stackoverflow.com/users/275', 'pm_score': 2, 'selected': False, 'text': '<p>why massive lookup table?</p>\n\n<pre><code>string GetWrittenInteger(int n)\n{\n  string[] a = new string[] {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" }\n  string[] b = new string[] { "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen" }\n  string[] c = new string[] {"Twenty", "Thirty", "Forty", "Sixty", "Seventy", "Eighty", "Ninety"};\n  string[] d = new string[] {"Hundred", "Thousand", "Million"}\n  string s = n.ToString();\n\n  for (int i = 0; i &lt; s.Length; i++)\n  {\n    // logic (too lazy but you get the idea)\n  }\n}\n</code></pre>\n'}, {'answer_id': 3228, 'author': 'Nick Masao', 'author_id': 487, 'author_profile': 'https://Stackoverflow.com/users/487', 'pm_score': 3, 'selected': False, 'text': '<p>I use this code.It is VB code but you can easily translate it to C#. It works</p>\n\n<pre><code>Function NumberToText(ByVal n As Integer) As String\n\n   Select Case n\nCase 0\n  Return ""\n\nCase 1 To 19\n  Dim arr() As String = {"One","Two","Three","Four","Five","Six","Seven", _\n    "Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen", _\n      "Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"}\n  Return arr(n-1) &amp; " "\n\nCase 20 to 99\n  Dim arr() as String = {"Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety"}\n  Return arr(n\\10 -2) &amp; " " &amp; NumberToText(n Mod 10)\n\nCase 100 to 199\n  Return "One Hundred " &amp; NumberToText(n Mod 100)\n\nCase 200 to 999\n  Return NumberToText(n\\100) &amp; "Hundreds " &amp; NumberToText(n mod 100)\n\nCase 1000 to 1999\n  Return "One Thousand " &amp; NumberToText(n Mod 1000)\n\nCase 2000 to 999999\n  Return NumberToText(n\\1000) &amp; "Thousands " &amp; NumberToText(n Mod 1000)\n\nCase 1000000 to 1999999\n  Return "One Million " &amp; NumberToText(n Mod 1000000)\n\nCase 1000000 to 999999999\n  Return NumberToText(n\\1000000) &amp; "Millions " &amp; NumberToText(n Mod 1000000)\n\nCase 1000000000 to 1999999999\n  Return "One Billion " &amp; NumberTotext(n Mod 1000000000)\n\nCase Else\n  Return NumberToText(n\\1000000000) &amp; "Billion " _\n    &amp; NumberToText(n mod 1000000000)\nEnd Select\nEnd Function\n</code></pre>\n\n<p>Here is the code in c#</p>\n\n<pre><code>public static string AmountInWords(double amount)\n{\n        var n = (int)amount;\n\n        if (n == 0)\n            return "";\n        else if (n &gt; 0 &amp;&amp; n &lt;= 19)\n        {\n            var arr = new string[] { "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen" };\n            return arr[n - 1] + " ";\n        }\n        else if (n &gt;= 20 &amp;&amp; n &lt;= 99)\n        {\n            var arr = new string[] { "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety" };\n            return arr[n / 10 - 2] + " " + AmountInWords(n % 10);\n        }\n        else if (n &gt;= 100 &amp;&amp; n &lt;= 199)\n        {\n            return "One Hundred " + AmountInWords(n % 100);\n        }\n        else if (n &gt;= 200 &amp;&amp; n &lt;= 999)\n        {\n            return AmountInWords(n / 100) + "Hundred " + AmountInWords(n % 100);\n        }\n        else if (n &gt;= 1000 &amp;&amp; n &lt;= 1999)\n        {\n            return "One Thousand " + AmountInWords(n % 1000);\n        }\n        else if (n &gt;= 2000 &amp;&amp; n &lt;= 999999)\n        {\n            return AmountInWords(n / 1000) + "Thousand " + AmountInWords(n % 1000);\n        }\n        else if (n &gt;= 1000000 &amp;&amp; n &lt;= 1999999)\n        {\n            return "One Million " + AmountInWords(n % 1000000);\n        }\n        else if (n &gt;= 1000000 &amp;&amp; n &lt;= 999999999)\n        {\n            return AmountInWords(n / 1000000) + "Million " + AmountInWords(n % 1000000);\n        }\n        else if (n &gt;= 1000000000 &amp;&amp; n &lt;= 1999999999)\n        {\n            return "One Billion " + AmountInWords(n % 1000000000);\n        }\n        else\n        {\n            return AmountInWords(n / 1000000000) + "Billion " + AmountInWords(n % 1000000000);\n        }\n    }\n</code></pre>\n'}, {'answer_id': 3267, 'author': 'Wedge', 'author_id': 332, 'author_profile': 'https://Stackoverflow.com/users/332', 'pm_score': 7, 'selected': True, 'text': '<p>This should work reasonably well:</p>\n\n<pre><code>public static class HumanFriendlyInteger\n{\n    static string[] ones = new string[] { "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" };\n    static string[] teens = new string[] { "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen" };\n    static string[] tens = new string[] { "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety" };\n    static string[] thousandsGroups = { "", " Thousand", " Million", " Billion" };\n\n    private static string FriendlyInteger(int n, string leftDigits, int thousands)\n    {\n        if (n == 0)\n        {\n            return leftDigits;\n        }\n\n        string friendlyInt = leftDigits;\n\n        if (friendlyInt.Length &gt; 0)\n        {\n            friendlyInt += " ";\n        }\n\n        if (n &lt; 10)\n        {\n            friendlyInt += ones[n];\n        }\n        else if (n &lt; 20)\n        {\n            friendlyInt += teens[n - 10];\n        }\n        else if (n &lt; 100)\n        {\n            friendlyInt += FriendlyInteger(n % 10, tens[n / 10 - 2], 0);\n        }\n        else if (n &lt; 1000)\n        {\n            friendlyInt += FriendlyInteger(n % 100, (ones[n / 100] + " Hundred"), 0);\n        }\n        else\n        {\n            friendlyInt += FriendlyInteger(n % 1000, FriendlyInteger(n / 1000, "", thousands+1), 0);\n            if (n % 1000 == 0)\n            {\n                return friendlyInt;\n            }\n        }\n\n        return friendlyInt + thousandsGroups[thousands];\n    }\n\n    public static string IntegerToWritten(int n)\n    {\n        if (n == 0)\n        {\n            return "Zero";\n        }\n        else if (n &lt; 0)\n        {\n            return "Negative " + IntegerToWritten(-n);\n        }\n\n        return FriendlyInteger(n, "", 0);\n    }\n}\n</code></pre>\n\n<p>(Edited to fix a bug w/ million, billion, etc.)</p>\n'}, {'answer_id': 8377509, 'author': 'Karthik', 'author_id': 1080359, 'author_profile': 'https://Stackoverflow.com/users/1080359', 'pm_score': 2, 'selected': False, 'text': '<pre><code>using System;\nusing System.Collections.Generic; \nusing System.Linq; \nusing System.Text; \n\nnamespace tryingstartfror4digits \n{ \n    class Program \n    { \n        static void Main(string[] args)\n        {\n            Program pg = new Program();\n            Console.WriteLine("Enter ur number");\n            int num = Convert.ToInt32(Console.ReadLine());\n\n            if (num &lt;= 19)\n            {\n                string g = pg.first(num);\n                Console.WriteLine("The number is " + g);\n            }\n            else if ((num &gt;= 20) &amp;&amp; (num &lt;= 99))\n            {\n                    if (num % 10 == 0)\n                    {\n                        string g = pg.second(num / 10);\n                        Console.WriteLine("The number is " + g);\n                    }\n                    else\n                    {\n                        string g = pg.second(num / 10) + pg.first(num % 10);\n                        Console.WriteLine("The number is " + g);\n                    }\n            }\n            else if ((num &gt;= 100) &amp;&amp; (num &lt;= 999))\n            {\n                int k = num % 100;\n                string g = pg.first(num / 100) +pg.third(0) + pg.second(k / 10)+pg.first(k%10);\n                Console.WriteLine("The number is " + g);\n            }\n            else if ((num &gt;= 1000) &amp;&amp; (num &lt;= 19999))\n            {\n                int h = num % 1000;\n                int k = h % 100;\n                string g = pg.first(num / 1000) + "Thousand " + pg.first(h/ 100) + pg.third(k) + pg.second(k / 10) + pg.first(k % 10);\n                Console.WriteLine("The number is " + g);\n            }\n\n            Console.ReadLine();\n        }\n\n        public string first(int num)\n        {\n            string name;\n\n            if (num == 0)\n            {\n                name = " ";\n            }\n            else\n            {\n                string[] arr1 = new string[] { "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" , "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"};\n                name = arr1[num - 1];\n            }\n\n            return name;\n        }\n\n        public string second(int num)\n        {\n            string name;\n\n            if ((num == 0)||(num==1))\n            {\n                 name = " ";\n            }\n            else\n            {\n                string[] arr1 = new string[] { "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety" };\n                name = arr1[num - 2];\n            }\n\n            return name;\n        }\n\n        public string third(int num)\n        {\n            string name ;\n\n            if (num == 0)\n            {\n                name = "";\n            }\n            else\n            {\n                string[] arr1 = new string[] { "Hundred" };\n                name = arr1[0];\n            }\n\n            return name;\n        }\n    }\n}\n</code></pre>\n\n<p>this works fine from 1 to 19999 will update soon after i complete it</p>\n'}, {'answer_id': 11943653, 'author': 'Joe Meyer', 'author_id': 1535329, 'author_profile': 'https://Stackoverflow.com/users/1535329', 'pm_score': 1, 'selected': False, 'text': '<p>Here is a <a href="http://forums.exchangecore.com/topic/684-convert-number-to-words-c-console-application/" rel="nofollow">C# Console Application</a> that will return whole numbers as well as decimals.</p>\n'}, {'answer_id': 27958953, 'author': 'Emre Guldogan', 'author_id': 197652, 'author_profile': 'https://Stackoverflow.com/users/197652', 'pm_score': 1, 'selected': False, 'text': '<p>Just for Turkish representation of the class <a href="https://stackoverflow.com/a/3267/197652">HumanFriendlyInteger</a> (&#8593;) (Türkçe, sayı yazı karşılığı):</p>\n\n<pre><code>public static class HumanFriendlyInteger\n{\n    static string[] ones = new string[] { "", "Bir", "İki", "Üç", "Dört", "Beş", "Altı", "Yedi", "Sekiz", "Dokuz" };\n    static string[] teens = new string[] { "On", "On Bir", "On İki", "On Üç", "On Dört", "On Beş", "On Altı", "On Yedi", "On Sekiz", "On Dokuz" };\n    static string[] tens = new string[] { "Yirmi", "Otuz", "Kırk", "Elli", "Altmış", "Yetmiş", "Seksen", "Doksan" };\n    static string[] thousandsGroups = { "", " Bin", " Milyon", " Milyar" };\n\n    private static string FriendlyInteger(int n, string leftDigits, int thousands)\n    {\n        if (n == 0)\n        {\n            return leftDigits;\n        }\n\n        string friendlyInt = leftDigits;\n\n        if (friendlyInt.Length &gt; 0)\n        {\n            friendlyInt += " ";\n        }\n\n        if (n &lt; 10)\n            friendlyInt += ones[n];\n        else if (n &lt; 20)\n            friendlyInt += teens[n - 10];\n        else if (n &lt; 100)\n            friendlyInt += FriendlyInteger(n % 10, tens[n / 10 - 2], 0);\n        else if (n &lt; 1000)\n            friendlyInt += FriendlyInteger(n % 100, ((n / 100 == 1 ? "" : ones[n / 100] + " ") + "Yüz"), 0); // Yüz 1 ile başlangıçta "Bir" kelimesini Türkçe\'de almaz.\n        else\n            friendlyInt += FriendlyInteger(n % 1000, FriendlyInteger(n / 1000, "", thousands + 1), 0);\n\n        return friendlyInt + thousandsGroups[thousands];\n    }\n\n    public static string IntegerToWritten(int n)\n    {\n        if (n == 0)\n            return "Sıfır";\n        else if (n &lt; 0)\n            return "Eksi " + IntegerToWritten(-n);\n\n        return FriendlyInteger(n, "", 0);\n    }\n</code></pre>\n'}, {'answer_id': 30468102, 'author': 'CleverPatrick', 'author_id': 22399, 'author_profile': 'https://Stackoverflow.com/users/22399', 'pm_score': 2, 'selected': False, 'text': '<p>The accepted answer doesn\'t seem to work perfectly. It doesn\'t handle dashes in numbers like twenty-one, it doesn\'t put the word "and" in for numbers like "one hundred and one", and, well, it is recursive.</p>\n\n<p>Here is my shot at the answer. It adds the "and" word intelligently, and hyphenates numbers appropriately. Let me know if any modifications are needed.</p>\n\n<p>Here is how to call it (obviously you will want to put this in a class somewhere):</p>\n\n<pre><code>for (int i = int.MinValue+1; i &lt; int.MaxValue; i++)\n{\n    Console.WriteLine(ToWords(i));\n}\n</code></pre>\n\n<p>Here is the code:</p>\n\n<pre><code>private static readonly string[] Ones = {"", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"};\n\nprivate static readonly string[] Teens =\n{\n    "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen",\n    "Seventeen", "Eighteen", "Nineteen"\n};\n\nprivate static readonly string[] Tens =\n{\n    "", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty",\n    "Ninety"\n};\n\npublic static string ToWords(int number)\n{\n    if (number == 0)\n        return "Zero";\n\n    var wordsList = new List&lt;string&gt;();\n\n    if (number &lt; 0)\n    {\n        wordsList.Add("Negative");\n        number = Math.Abs(number);\n    }\n\n    if (number &gt;= 1000000000 &amp;&amp; number &lt;= int.MaxValue) //billions\n    {\n        int billionsValue = number / 1000000000;\n        GetValuesUnder1000(billionsValue, wordsList);\n        wordsList.Add("Billion");\n        number -= billionsValue * 1000000000;\n\n        if (number &gt; 0 &amp;&amp; number &lt; 10)\n            wordsList.Add("and");\n    }\n\n    if (number &gt;= 1000000 &amp;&amp; number &lt; 1000000000) //millions\n    {\n        int millionsValue = number / 1000000;\n        GetValuesUnder1000(millionsValue, wordsList);\n        wordsList.Add("Million");\n        number -= millionsValue * 1000000;\n\n        if (number &gt; 0 &amp;&amp; number &lt; 10)\n            wordsList.Add("and");\n    }\n\n    if (number &gt;= 1000 &amp;&amp; number &lt; 1000000) //thousands\n    {\n        int thousandsValue = number/1000;\n        GetValuesUnder1000(thousandsValue, wordsList);\n        wordsList.Add("Thousand");\n        number -= thousandsValue * 1000;\n\n        if (number &gt; 0 &amp;&amp; number &lt; 10)\n            wordsList.Add("and");\n    }\n\n    GetValuesUnder1000(number, wordsList);\n\n    return string.Join(" ", wordsList);\n}\n\nprivate static void GetValuesUnder1000(int number, List&lt;string&gt; wordsList)\n{\n    while (number != 0)\n    {\n        if (number &lt; 10)\n        {\n            wordsList.Add(Ones[number]);\n            number -= number;\n        }\n        else if (number &lt; 20)\n        {\n            wordsList.Add(Teens[number - 10]);\n            number -= number;\n        }\n        else if (number &lt; 100)\n        {\n            int tensValue = ((int) (number/10))*10;\n            int onesValue = number - tensValue;\n\n            if (onesValue == 0)\n            {\n                wordsList.Add(Tens[tensValue/10]);\n            }\n            else\n            {\n                wordsList.Add(Tens[tensValue/10] + "-" + Ones[onesValue]);\n            }\n\n            number -= tensValue;\n            number -= onesValue;\n        }\n        else if (number &lt; 1000)\n        {\n            int hundredsValue = ((int) (number/100))*100;\n            wordsList.Add(Ones[hundredsValue/100]);\n            wordsList.Add("Hundred");\n            number -= hundredsValue;\n\n            if (number &gt; 0)\n                wordsList.Add("and");\n        }\n    }\n}\n</code></pre>\n'}, {'answer_id': 31827074, 'author': 'Dhiraj D B', 'author_id': 3877940, 'author_profile': 'https://Stackoverflow.com/users/3877940', 'pm_score': 1, 'selected': False, 'text': '<p>Just get that string and convert with  the\nlike as</p>\n<pre><code>string s = txtNumber.Text.Tostring();\nint i = Convert.ToInt32(s.Tostring());\n</code></pre>\n<p>It will write only full integer value</p>\n'}, {'answer_id': 34197484, 'author': 'SArifin', 'author_id': 5035041, 'author_profile': 'https://Stackoverflow.com/users/5035041', 'pm_score': 1, 'selected': False, 'text': '<p>An extension of Nick Masao\'s answer for Bengali Numeric of same problem. Inital input of number is in Unicode string.  Cheers!!</p>\n\n<pre><code>string number = "২২৮৯";\nnumber = number.Replace("০", "0").Replace("১", "1").Replace("২", "2").Replace("৩", "3").Replace("৪", "4").Replace("৫", "5").Replace("৬", "6").Replace("৭", "7").Replace("৮", "8").Replace("৯", "9");\ndouble vtempdbl = Convert.ToDouble(number);\nstring amount = AmountInWords(vtempdbl);\n\nprivate static string AmountInWords(double amount)\n    {\n        var n = (int)amount;\n\n        if (n == 0)\n            return " ";\n        else if (n &gt; 0 &amp;&amp; n &lt;= 99)\n        {\n            var arr = new string[] {  "এক", "দুই",  "তিন",  "চার",  "পাঁচ", "ছয়",  "সাত",  "আট",   "নয়",  "দশ",   "এগার", "বারো", "তের",  "চৌদ্দ",    "পনের", "ষোল", "সতের", "আঠার", "ঊনিশ", "বিশ",  "একুশ", "বাইস", "তেইশ", "চব্বিশ",   "পঁচিশ",    "ছাব্বিশ",  "সাতাশ",    "আঠাশ", "ঊনত্রিশ",  "ত্রিশ",    "একত্রিস",  "বত্রিশ",   "তেত্রিশ",  "চৌত্রিশ",  "পঁয়ত্রিশ", "ছত্রিশ",   "সাঁইত্রিশ",    "আটত্রিশ",  "ঊনচল্লিশ", "চল্লিশ",   "একচল্লিশ", "বিয়াল্লিশ",    "তেতাল্লিশ",    "চুয়াল্লিশ",    "পয়তাল্লিশ",    "ছিচল্লিশ", "সাতচল্লিশ",    "আতচল্লিশ", "উনপঞ্চাশ", "পঞ্চাশ",   "একান্ন",   "বায়ান্ন",  "তিপ্পান্ন",    "চুয়ান্ন",  "পঞ্চান্ন", "ছাপ্পান্ন",    "সাতান্ন",  "আটান্ন",   "উনষাট",    "ষাট",  "একষট্টি",  "বাষট্টি",  "তেষট্টি",  "চৌষট্টি",  "পয়ষট্টি",  "ছিষট্টি",  " সাতষট্টি",    "আটষট্টি",  "ঊনসত্তর ", "সত্তর",    "একাত্তর ", "বাহাত্তর", "তেহাত্তর", "চুয়াত্তর", "পঁচাত্তর", "ছিয়াত্তর", "সাতাত্তর", "আটাত্তর",  "ঊনাশি",    "আশি",  "একাশি",    "বিরাশি",   "তিরাশি",   "চুরাশি",   "পঁচাশি",   "ছিয়াশি",   "সাতাশি",   "আটাশি",    "উননব্বই",  "নব্বই",    "একানব্বই", "বিরানব্বই",    "তিরানব্বই",    "চুরানব্বই",    "পঁচানব্বই ",   "ছিয়ানব্বই ",   "সাতানব্বই",    "আটানব্বই", "নিরানব্বই" };\n            return arr[n - 1] + " ";\n        }\n        else if (n &gt;= 100 &amp;&amp; n &lt;= 199)\n        {\n            return AmountInWords(n / 100) + "এক শত " + AmountInWords(n % 100);\n        }\n\n        else if (n &gt;= 100 &amp;&amp; n &lt;= 999)\n        {\n            return AmountInWords(n / 100) + "শত " + AmountInWords(n % 100);\n        }\n        else if (n &gt;= 1000 &amp;&amp; n &lt;= 1999)\n        {\n            return "এক হাজার " + AmountInWords(n % 1000);\n        }\n        else if (n &gt;= 1000 &amp;&amp; n &lt;= 99999)\n        {\n            return AmountInWords(n / 1000) + "হাজার " + AmountInWords(n % 1000);\n        }\n        else if (n &gt;= 100000 &amp;&amp; n &lt;= 199999)\n        {\n            return "এক লাখ " + AmountInWords(n % 100000);\n        }\n        else if (n &gt;= 100000 &amp;&amp; n &lt;= 9999999)\n        {\n            return AmountInWords(n / 100000) + "লাখ " + AmountInWords(n % 100000);\n        }\n        else if (n &gt;= 10000000 &amp;&amp; n &lt;= 19999999)\n        {\n            return "এক কোটি " + AmountInWords(n % 10000000);\n        }\n        else\n        {\n            return AmountInWords(n / 10000000) + "কোটি " + AmountInWords(n % 10000000);\n        }\n    }\n</code></pre>\n'}, {'answer_id': 39917660, 'author': 'Mari Faleiros', 'author_id': 6093407, 'author_profile': 'https://Stackoverflow.com/users/6093407', 'pm_score': 4, 'selected': False, 'text': '<p>I use this handy library called Humanizer. </p>\n\n<p><a href="https://github.com/Humanizr/Humanizer" rel="noreferrer">https://github.com/Humanizr/Humanizer</a></p>\n\n<p>It supports several cultures and converts not only numbers to words but also date and it\'s very simple to use.</p>\n\n<p>Here\'s how I use it:</p>\n\n<pre><code>int someNumber = 543;\nvar culture = System.Globalization.CultureInfo("en-US");\nvar result = someNumber.ToWords(culture); // 543 -&gt; five hundred forty-three\n</code></pre>\n\n<p>And voilá!</p>\n'}, {'answer_id': 44401667, 'author': 'Santhosh', 'author_id': 6851131, 'author_profile': 'https://Stackoverflow.com/users/6851131', 'pm_score': 1, 'selected': False, 'text': '<p>The following C# console app code will accepts a monetary value in numbers up to 2 decimals and prints it in English. This not only converts integer to its English equivalent but as a monetary value in dollars and cents. </p>\n\n<pre><code> namespace ConsoleApplication2\n{\n    using System;\n    using System.Collections.Generic;\n    using System.Linq;\n    using System.Text.RegularExpressions;\n    class Program\n    {\n       static void Main(string[] args)\n        {\n            bool repeat = true;\n            while (repeat)\n            {\n                string inputMonetaryValueInNumberic = string.Empty;\n                string centPart = string.Empty;\n                string dollarPart = string.Empty;\n                Console.Write("\\nEnter the monetary value : ");\n                inputMonetaryValueInNumberic = Console.ReadLine();\n                inputMonetaryValueInNumberic = inputMonetaryValueInNumberic.TrimStart(\'0\');\n\n                if (ValidateInput(inputMonetaryValueInNumberic))\n                {\n\n                    if (inputMonetaryValueInNumberic.Contains(\'.\'))\n                    {\n                        centPart = ProcessCents(inputMonetaryValueInNumberic.Substring(inputMonetaryValueInNumberic.IndexOf(".") + 1));\n                        dollarPart = ProcessDollar(inputMonetaryValueInNumberic.Substring(0, inputMonetaryValueInNumberic.IndexOf(".")));\n                    }\n                    else\n                    {\n                        dollarPart = ProcessDollar(inputMonetaryValueInNumberic);\n                    }\n                    centPart = string.IsNullOrWhiteSpace(centPart) ? string.Empty : " and " + centPart;\n                    Console.WriteLine(string.Format("\\n\\n{0}{1}", dollarPart, centPart));\n                }\n                else\n                {\n                    Console.WriteLine("Invalid Input..");\n                }\n\n                Console.WriteLine("\\n\\nPress any key to continue or Escape of close : ");\n                var loop = Console.ReadKey();\n                repeat = !loop.Key.ToString().Contains("Escape");\n                Console.Clear();\n            }\n\n        }\n\n        private static string ProcessCents(string cents)\n        {\n            string english = string.Empty;\n            string dig3 = Process3Digit(cents);\n            if (!string.IsNullOrWhiteSpace(dig3))\n            {\n                dig3 = string.Format("{0} {1}", dig3, GetSections(0));\n            }\n            english = dig3 + english;\n            return english;\n        }\n        private static string ProcessDollar(string dollar)\n        {\n            string english = string.Empty;\n            foreach (var item in Get3DigitList(dollar))\n            {\n                string dig3 = Process3Digit(item.Value);\n                if (!string.IsNullOrWhiteSpace(dig3))\n                {\n                    dig3 = string.Format("{0} {1}", dig3, GetSections(item.Key));\n                }\n                english = dig3 + english;\n            }\n            return english;\n        }\n        private static string Process3Digit(string digit3)\n        {\n            string result = string.Empty;\n            if (Convert.ToInt32(digit3) != 0)\n            {\n                int place = 0;\n                Stack&lt;string&gt; monetaryValue = new Stack&lt;string&gt;();\n                for (int i = digit3.Length - 1; i &gt;= 0; i--)\n                {\n                    place += 1;\n                    string stringValue = string.Empty;\n                    switch (place)\n                    {\n                        case 1:\n                            stringValue = GetOnes(digit3[i].ToString());\n                            break;\n                        case 2:\n                            int tens = Convert.ToInt32(digit3[i]);\n                            if (tens == 1)\n                            {\n                                if (monetaryValue.Count &gt; 0)\n                                {\n                                    monetaryValue.Pop();\n                                }\n                                stringValue = GetTens((digit3[i].ToString() + digit3[i + 1].ToString()));\n                            }\n                            else\n                            {\n                                stringValue = GetTens(digit3[i].ToString());\n                            }\n                            break;\n                        case 3:\n                            stringValue = GetOnes(digit3[i].ToString());\n                            if (!string.IsNullOrWhiteSpace(stringValue))\n                            {\n                                string postFixWith = " Hundred";\n                                if (monetaryValue.Count &gt; 0)\n                                {\n                                    postFixWith = postFixWith + " And";\n                                }\n                                stringValue += postFixWith;\n                            }\n                            break;\n                    }\n                    if (!string.IsNullOrWhiteSpace(stringValue))\n                        monetaryValue.Push(stringValue);\n                }\n                while (monetaryValue.Count &gt; 0)\n                {\n                    result += " " + monetaryValue.Pop().ToString().Trim();\n                }\n            }\n            return result;\n        }\n        private static Dictionary&lt;int, string&gt; Get3DigitList(string monetaryValueInNumberic)\n        {\n            Dictionary&lt;int, string&gt; hundredsStack = new Dictionary&lt;int, string&gt;();\n            int counter = 0;\n            while (monetaryValueInNumberic.Length &gt;= 3)\n            {\n                string digit3 = monetaryValueInNumberic.Substring(monetaryValueInNumberic.Length - 3, 3);\n                monetaryValueInNumberic = monetaryValueInNumberic.Substring(0, monetaryValueInNumberic.Length - 3);\n                hundredsStack.Add(++counter, digit3);\n            }\n            if (monetaryValueInNumberic.Length != 0)\n                hundredsStack.Add(++counter, monetaryValueInNumberic);\n            return hundredsStack;\n        }\n        private static string GetTens(string tensPlaceValue)\n        {\n            string englishEquvalent = string.Empty;\n            int value = Convert.ToInt32(tensPlaceValue);\n            Dictionary&lt;int, string&gt; tens = new Dictionary&lt;int, string&gt;();\n            tens.Add(2, "Twenty");\n            tens.Add(3, "Thirty");\n            tens.Add(4, "Forty");\n            tens.Add(5, "Fifty");\n            tens.Add(6, "Sixty");\n            tens.Add(7, "Seventy");\n            tens.Add(8, "Eighty");\n            tens.Add(9, "Ninty");\n            tens.Add(10, "Ten");\n            tens.Add(11, "Eleven");\n            tens.Add(12, "Twelve");\n            tens.Add(13, "Thrteen");\n            tens.Add(14, "Fourteen");\n            tens.Add(15, "Fifteen");\n            tens.Add(16, "Sixteen");\n            tens.Add(17, "Seventeen");\n            tens.Add(18, "Eighteen");\n            tens.Add(19, "Ninteen");\n            if (tens.ContainsKey(value))\n            {\n                englishEquvalent = tens[value];\n            }\n\n            return englishEquvalent;\n\n        }\n        private static string GetOnes(string onesPlaceValue)\n        {\n            int value = Convert.ToInt32(onesPlaceValue);\n            string englishEquvalent = string.Empty;\n            Dictionary&lt;int, string&gt; ones = new Dictionary&lt;int, string&gt;();\n            ones.Add(1, " One");\n            ones.Add(2, " Two");\n            ones.Add(3, " Three");\n            ones.Add(4, " Four");\n            ones.Add(5, " Five");\n            ones.Add(6, " Six");\n            ones.Add(7, " Seven");\n            ones.Add(8, " Eight");\n            ones.Add(9, " Nine");\n\n            if (ones.ContainsKey(value))\n            {\n                englishEquvalent = ones[value];\n            }\n\n            return englishEquvalent;\n        }\n        private static string GetSections(int section)\n        {\n            string sectionName = string.Empty;\n            switch (section)\n            {\n                case 0:\n                    sectionName = "Cents";\n                    break;\n                case 1:\n                    sectionName = "Dollars";\n                    break;\n                case 2:\n                    sectionName = "Thousand";\n                    break;\n                case 3:\n                    sectionName = "Million";\n                    break;\n                case 4:\n                    sectionName = "Billion";\n                    break;\n                case 5:\n                    sectionName = "Trillion";\n                    break;\n                case 6:\n                    sectionName = "Zillion";\n                    break;\n            }\n            return sectionName;\n        }\n        private static bool ValidateInput(string input)\n        {\n            return Regex.IsMatch(input, "[0-9]{1,18}(\\\\.[0-9]{1,2})?"))\n        }\n    }\n}\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/3213', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/383/']