use this code
public string RupeeInWords(decimal value)
{
return Towords(value);
}
public string Towords(decimal Num)
{
string stmp = ""; int i, leng, prevdigit = 0, digit = 0, pos = 0;
string snum = "", laststr = "";
string pointVlu = "";
string[] sVlu = Convert.ToString(Num).Split('.');
stmp = getInWord(Convert.ToInt32(sVlu[0]));
if (sVlu.Length > 1) pointVlu = getInWord(Convert.ToInt32(sVlu[1]));
if (!pointVlu.Equals(""))
{
if (stmp.Equals(""))
stmp = "Zero ";
stmp += "Rupee and " + pointVlu + " Paisa";
}
return stmp.Trim();
}
string getInWord(int Num)
{
string stmp = ""; int i, leng, prevdigit = 0, digit = 0, pos = 0;
string snum = "", laststr = "";
snum = Convert.ToString(Num);
leng = snum.Length;
#region Loop Process
for (i = leng; i > 0; i--)
{
if (snum.Substring(i - 1, 1) == "-")
{
continue;
}
digit = Convert.ToInt32(snum.Substring(i - 1, 1));
pos = leng - i + 1;
switch (pos)
{
case 1:
case 3:
case 4:
case 6:
case 8:
case 10:
case 11:
case 13:
case 15:
{
if (digit != 0)
{
switch (pos)
{
case 8:
case 15:
laststr = "Crore ";
break;
case 3:
case 10:
laststr = "Hundred ";
break;
case 4:
case 11:
laststr = "Thousand ";
break;
case 6:
case 13:
laststr = "Lakh ";
break;
}
stmp = laststr + stmp;
}
switch (digit)
{
case 0:
if (pos == 1)
laststr = "Zero ";
else
laststr = "";
break;
case 1:
laststr = "One ";
break;
case 2:
laststr = "Two ";
break;
case 3:
laststr = "Three ";
break;
case 4:
laststr = "Four ";
break;
case 5:
laststr = "Five ";
break;
case 6:
laststr = "Six ";
break;
case 7:
laststr = "Seven ";
break;
case 8:
laststr = "Eight ";
break;
case 9:
laststr = "Nine ";
break;
}
stmp = laststr + stmp;
} break;
case 2:
case 5:
case 7:
case 9:
case 12:
case 14:
{
if (prevdigit == 0)
{
switch (pos)
{
case 9:
laststr = "Crore ";
break;
case 7:
case 14:
if (digit != 0) laststr = "Lakh "; break;
case 5:
case 12:
if (digit != 0) laststr = "Thousand "; break;
}
stmp = laststr + stmp;
}
switch (digit)
{
case 0:
if (prevdigit != 0)
laststr = "And ";
else
laststr = "";
break;
case 1:
switch (prevdigit)
{
case 0:
laststr = "Ten ";
break;
case 1:
stmp = "Eleven " + stmp.Substring(4);
break;
case 2:
stmp = "Twelve " + stmp.Substring(4);
break;
case 3:
stmp = "Thirteen " + stmp.Substring(6);
break;
case 4:
stmp = "Fourteen " + stmp.Substring(5);
break;
case 5:
stmp = "Fifteen " + stmp.Substring(5);
break;
case 6:
stmp = "Sixteen " + stmp.Substring(4);
break;
case 7:
stmp = "Seventeen " + stmp.Substring(6);
break;
case 8:
stmp = "Eighteen " + stmp.Substring(6);
break;
case 9:
stmp = "Nineteen " + stmp.Substring(5);
break;
} break;
case 2:
laststr = "Twenty "; break;
case 3:
laststr = "Thirty "; break;
case 4:
laststr = "Forty "; break;
case 5:
laststr = "Fifty "; break;
case 6:
laststr = "Sixty "; break;
case 7:
laststr = "Seventy "; break;
case 8:
laststr = "Eighty "; break;
case 9:
laststr = "Ninty "; break;
}
stmp = stmp.Replace("Zero ", "");
stmp = laststr + stmp;
} break;
}
prevdigit = digit;
laststr = "";
}
#endregion
return stmp.Trim();
}