title: Convert number with decimals (in currency) to words
body: <p>I want to convert numbers With decimal (in currency )to word</p>
  
  <p>ex.: 12345.60
  -->  twelve thousand three hundred forty-five dollars   and   sixty  cents</p>
  
  <p>i got this code  from
  <a href="http://www.csharp-tutorials.info/2016/04/convert-numbers-to-words-in-c.html" rel="nofollow noreferrer">http://www.csharp-tutorials.info/2016/04/convert-numbers-to-words-in-c.html</a></p>
  
  <pre><code> public static string NumberToWords(int number)
      {
          if (number == 0)
              return "zero";
  
          if (number &lt; 0)
              return "minus " + NumberToWords(Math.Abs(number));
  
          string words = "";
  
          if ((number / 1000000000) &gt; 0)
          {
              words += NumberToWords(number / 1000000000) + " billion ";
              number %= 1000000000;
          }
  
          if ((number / 1000000) &gt; 0)
          {
              words += NumberToWords(number / 1000000) + " million ";
              number %= 1000000;
          }
  
          if ((number / 1000) &gt; 0)
          {
              words += NumberToWords(number / 1000) + " thousand ";
              number %= 1000;
          }
  
          if ((number / 100) &gt; 0)
          {
              words += NumberToWords(number / 100) + " hundred ";
              number %= 100;
          }
  
          if (number &gt; 0)
          {
              if (words != "")
                  words += " ";
  
              var unitsMap = new[] { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };
              var tensMap = new[] { "zero", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" };
  
              if (number &lt; 20)
                  words += unitsMap[number];
              else
              {
                  words += tensMap[number / 10];
                  if ((number % 10) &gt; 0)
                      words += "-" + unitsMap[number % 10];
              }
          }
  
          return words;
      }
  </code></pre>
  
  <p>it work totally fine with integers but if input double..
  it shows error</p>
  
  <p>because it only accept int.</p>
  
  <p>I try my best with my knowledge but I cant alter the code to get what i want.. </p>