473,396 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

I want to convert the number in Words.Could anyone please help me

Hi,i want to convert the Digits in words.I have already a code but in my code the value is coming like for ex:-540000(Five hundered and Fourty Thousand ).but i want Five Lakh and Fourty thousand.Could anyone please help me.I would appreciate for this.
Oct 12 '13 #1
4 1395
Luuk
1,047 Expert 1GB
show your code here and someone with understanding about 'Lakh' should give an answer.
Oct 12 '13 #2
Luuk
1,047 Expert 1GB
hmmm, those Indians do it in a different way ;)
http://en.wikipedia.org/wiki/Indian_Numbering_System
Oct 12 '13 #3
dear sir,

Expand|Select|Wrap|Line Numbers
  1.   if (number == 0)
  2.         {
  3.             return "Zero";
  4.         }
  5.         if(number < 0)
  6.  
  7.             return "Minus" + NumberToWords(Math.Abs(number)) + "";
  8.             string words = "";
  9.  
  10.         if ((number / 100000000) > 0)
  11.         {
  12.             words += NumberToWords(number / 10000000) + "" +  "Crore" + "";
  13.             number %= 10000000;
  14.         }
  15.         if ((number / 1000000) > 0)
  16.         {
  17.             words += NumberToWords(number / 100000) + "" + "Lakh" + "";
  18.             number %= 100000;
  19.         }
  20.         if ((number / 1000) > 0)
  21.         {
  22.             words += NumberToWords(number / 1000) + "" + "Thousand" + "";
  23.             number %= 1000;
  24.         }
  25.         if ((number / 100) > 0)
  26.         {
  27.             words += NumberToWords(number / 100) + "" + "Hundred" + "";
  28.             number %= 100;
  29.         }
  30.         if (number > 0)
  31.         {
  32.             if (words != "")
  33.  
  34.                 words += "and" + "";
  35.                 var unitW = new[] { "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight","Nine", "Ten", "Eleven", "Tweleve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen","Nineteen" };
  36.                 var tenW = new[] { "Zero", "Ten", "Twenty", "Thirty", "Forty", "Fivety", "Sixty", "Seventy","Eighty", "Ninety" };
  37.  
  38.  
  39.                 if (number < 20)
  40.  
  41.                     words += unitW[number];
  42.                 else
  43.                 {
  44.                     words += tenW[number / 10];
  45.                     if ((number % 10) > 0)
  46.                     {
  47.                         words+=" "+unitW[number % 10];
  48.                     }
  49.                 }
  50.         }
  51.         return words;
Regards
Gagandeep Singh
Oct 14 '13 #4
aswal
38
you've taken 10,00,000 instead of 1,00,000 as your condition for Lakh and 10,00,00,000 instead of 1,00,00,000 as you condition for Crore.
Oct 23 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: TaeHo Yoo | last post by:
I have a table that has more than 1 milion rows so practically it is impossible to remove all duplicate rows by hand. Could you help me to remove those duplicate rows at all? This table doesn't...
0
by: ZSP747 | last post by:
Now,I prepare to write a English-Chinese dictionary.So I want find a function or library can convert the words from one form to another,such as "boys"->"boy","became->become","went"->"go"....
5
by: ZSP747 | last post by:
Now,I prepare to write a English-Chinese dictionary. So I want find a function or library can convert the words from one form to another,such as "boys"->"boy","became->become","went"->"go"....
2
by: bobdydd | last post by:
Hi All Access 2007 Windows XP I have a table called: UsystblApplication Which has 2 fields called: 1. FieldName 2. Number
5
by: jenipriya | last post by:
I have an employee table which contains the fields EmpId,EmpName,DeptId,DateOfJoin,Sal,Addr how to write a trigger for this table such that whenever a new employee is added to the...
4
by: deviii1 | last post by:
3 - H in a TPBB 4 - V of a W in S 17 - of M is SPD 54 - C the F in B 60 - D of EA of an ET Any help with these questions would be greatly appreciated. Many thanks.
2
by: nineballssj9 | last post by:
#include <stdio.h> #include <string.h> #include <math.h> //i'm trying to convert number into word like for an example if i type //99.99 then it will print ninety nine point ninety nine //can...
2
by: moon123 | last post by:
We have to program it in two parts: the lexical analyzer and the syntax analyzer plus semantic.The lexical analyzer should recognize the token using DFA and return the token and the value. The syntax...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.