Here, I have described how to convert numeric values to words - not only whole numbers but also, the numbers with decimal values. For example,
562.53 = Five Hundred And Sixty Two Point Fifty Three Only.
The function is named "ConvertAmount" and accepts a parameter of type double. First, the function checks the existence of decimal in the number passed as a parameter.

If decimal exists, it constructs the word for point value. After removing the decimal digits from the number, it converts digits, tens, and hundreds by using the function "Convert" and returns a string containing the number in words.
  1. class NumberToWords
  2. {
  3. private static String[] units = { "Zero", "One", "Two", "Three",
  4. "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven",
  5. "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen",
  6. "Seventeen", "Eighteen", "Nineteen" };
  7. private static String[] tens = { "", "", "Twenty", "Thirty", "Forty",
  8. "Fifty", "Sixty", "Seventy", "Eighty", "Ninety" };
  9. public static String ConvertAmount(double amount)
  10. {
  11. try
  12. {
  13. Int64 amount_int = (Int64)amount;
  14. Int64 amount_dec = (Int64)Math.Round((amount - (double)(amount_int)) * 100);
  15. if (amount_dec == 0)
  16. {
  17. return Convert(amount_int) + " Only.";
  18. }
  19. else
  20. {
  21. return Convert(amount_int) + " Point " + Convert(amount_dec) + " Only.";
  22. }
  23. }
  24. catch (Exception e)
  25. {
  26. // TODO: handle exception
  27. }
  28. return "";
  29. }
  30. public static String Convert(Int64 i)
  31. {
  32. if (i < 20)
  33. {
  34. return units[i];
  35. }
  36. if (i < 100)
  37. {
  38. return tens[i / 10] + ((i % 10 > 0) ? " " + Convert(i % 10) : "");
  39. }
  40. if (i < 1000)
  41. {
  42. return units[i / 100] + " Hundred"
  43. + ((i % 100 > 0) ? " And " + Convert(i % 100) : "");
  44. }
  45. if (i < 100000)
  46. { return Convert(i / 1000) + " Thousand "
  47. + ((i % 1000 > 0) ? " " + Convert(i % 1000) : "");
  48. }
  49. if (i < 10000000)
  50. {
  51. return Convert(i / 100000) + " Lakh "
  52. + ((i % 100000 > 0) ? " " + Convert(i % 100000) : "");
  53. }
  54. if (i < 1000000000)
  55. {
  56. return Convert(i / 10000000) + " Crore "
  57. + ((i % 10000000 > 0) ? " " + Convert(i % 10000000) : "");
  58. }
  59. return Convert(i / 1000000000) + " Arab "
  60. + ((i % 1000000000 > 0) ? " " + Convert(i % 1000000000) : "");
  61. }
  62. }
Now, call the ConvertAmount method.
  1. static void Main(string[] args)
  2. {
  3. try
  4. {
  5. Console.WriteLine("Enter a Number to convert to words");
  6. string number = Console.ReadLine();
  7. number = ConvertAmount(double.Parse(number));
  8. Console.WriteLine("Number in words is \n{0}", number);
  9. Console.ReadKey();
  10. }
  11. catch (Exception ex)
  12. {
  13. Console.WriteLine(ex.Message);
  14. }
  15. }
I hope this is useful for all readers. Happy Coding!