private static String[] units = { "Zero", "One", "Two", "Three",
"Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven",
"Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen",
"Seventeen", "Eighteen", "Nineteen" };
private static String[] tens = { "", "", "Twenty", "Thirty", "Forty",
"Fifty", "Sixty", "Seventy", "Eighty", "Ninety" };
public static void Main()
Console.WriteLine("Enter a Number to convert to words");
string number = "1,24,367";
number = number.Replace(",", "");
number = ConvertAmount(double.Parse(number));
Console.WriteLine("Number in words is \n{0}", number);
Console.WriteLine(ex.Message);
public static string ConvertAmount(double amount)
Int64 amount_int = (Int64)amount;
Int64 amount_dec = (Int64)Math.Round((amount - (double)(amount_int)) * 100);
return Convert(amount_int) + " Only.";
return Convert(amount_int) + " Rupees and " + Convert(amount_dec) + " Paise Only.";
public static String Convert(Int64 i)
return tens[i / 10] + ((i % 10 > 0) ? " " + Convert(i % 10) : "");
return units[i / 100] + " Hundred"
+ ((i % 100 > 0) ? " " + Convert(i % 100) : "");
{ return Convert(i / 1000) + " Thousand"
+ ((i % 1000 > 0) ? " " + Convert(i % 1000) : "");
return Convert(i / 100000) + " Lakh"
+ ((i % 100000 > 0) ? " " + Convert(i % 100000) : "");
return Convert(i / 10000000) + " Crore"
+ ((i % 10000000 > 0) ? " " + Convert(i % 10000000) : "");
return Convert(i / 1000000000) + " Arab"
+ ((i % 1000000000 > 0) ? " " + Convert(i % 1000000000) : "");