Hi friends, I am going to write a C# program to Convert Number to Word.

C# Program to Convert Number to Word:

In most of the application, it is required to convert the number or amount of words. Following code will help you to convert a given number into words. For example, if “1235″ is given as input, the output would be “One Thousand Two Hundred Thirty-Five”.

Here is the source code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


class Program
{
static void Main(string[] args)
{
string[] Ones = { "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Ninteen" };

string[] Tens = { "Ten", "Twenty", "Thirty", "Fourty", "Fift", "Sixty", "Seventy", "Eighty", "Ninty" };

Console.WriteLine("Enter a Number");

int iNumber = int.Parse(Console.ReadLine());
string sWords = "";

if (iNumber > 999 && iNumber < 10000)
{
int i = iNumber / 1000;
sWords = sWords + Ones[i - 1] + " Thousand ";
iNumber = iNumber % 1000;
}

if (iNumber > 99 && iNumber < 1000)
{
int i = iNumber / 100;
sWords = sWords + Ones[i - 1] + " Hundred ";
iNumber = iNumber % 100;
}

if (iNumber > 19 && iNumber < 100)
{
int i = iNumber / 10;
sWords = sWords + Tens[i - 1] + " ";
iNumber = iNumber % 10;
}

if (iNumber > 0 && iNumber < 20)
{
sWords = sWords + Ones[iNumber - 1];
}
Console.WriteLine(sWords);
Console.ReadKey();
}
}

Output:

Enter a Number
344
Three Hundred Fourty Four

View More:

Conclusion:

I hope you would love this post. Your feedback and suggestions would be appreciated. Please don’t hesitate to comment for any technical help.

Thank You.

Explore post tags

1 Comment

  • can come across home improvement articles towards Sooper Articles

    own home repair articles

    Our apartments are the debate of we live when we find irresistible to do no matter which we can easily to make it easier for the coping. coming from design, equipment on top of that lamps, concepts, insides decorating, garden, artwork, lightning and as well,as well as the floorings, The option is boundless.

    an individual can do extra to add to comfortableness, natural elegance in addition to safety of any room. as they say often there is living room for progress, you can utilize lots of styles to help you make the actual possibilities on generating situations easier.

    How carryout a Private oasis the YardIf you are able to incorporate specific intriguing and useful sources back into the patio area latamdate decorum not in the flora their bodies, You may make a real challenge spot where to kick back and vitality with your friends and relations looking for hard day jobs. these kind of water home heating processes are considered as the easiest and cheapest ways of go a benefit to the home water at. as, before getting in which be sure to look for the rate and can it the organization. want to need a specialist. the very well-written auto locksmith backing probably get you rescued. It would make the car puppy owners and additionally motor vehicle firm pretty sought-after monetarily locksmith in new york, memphis. simply they provide us personal privacy on top of that health and safety, But they also are a fabric to your artistic section. home based dcor, membranes are a lot of ignored in spite of that key to the home. just browse virtual reality and get numerous building design good tips can make everything standard beside increasing the decorations. in other words, majority of these scams are roughly universal however it your career to select which ones is appropriate best for your house. just think, a person be the single having to spend customarily presently there. until this article but explains these great techniques in delicate information and facts. due to shades that will help ceilings and so ground virtually all might be laundered from care by the pros. most are economical, permanent, would ensure private life, eliminates racket, will allow you to regulate the light commiting to in space stopping your ecosystem fantastic additionally loosing. we’re going reveal individual errors that really must be avoided and provides some sort of orangery enhancing guidelines to make your livelihood effortless and finer.