Click here to Skip to main content
15,888,984 members
Home / Discussions / C#
   

C#

 
AnswerRe: Delegates Pin
OriginalGriff24-Jan-17 2:26
mveOriginalGriff24-Jan-17 2:26 
QuestionPlz Send Me The Simpler Answer to connect with SSIS And SSRS Both In any Version fo the Excell Pin
Member 889223723-Jan-17 23:45
Member 889223723-Jan-17 23:45 
GeneralRe: Plz Send Me The Simpler Answer to connect with SSIS And SSRS Both In any Version fo the Excell Pin
Richard MacCutchan24-Jan-17 0:42
mveRichard MacCutchan24-Jan-17 0:42 
Questionnumber converter Pin
ab_ayo23-Jan-17 1:51
ab_ayo23-Jan-17 1:51 
AnswerRe: number converter Pin
Richard MacCutchan23-Jan-17 2:07
mveRichard MacCutchan23-Jan-17 2:07 
AnswerRe: number converter Pin
Patrice T23-Jan-17 9:52
mvePatrice T23-Jan-17 9:52 
GeneralRe: number converter Pin
Ed E24-Jan-17 9:22
professionalEd E24-Jan-17 9:22 
AnswerRe: number converter Pin
palikhelsanjeeb25-Jan-17 21:55
palikhelsanjeeb25-Jan-17 21:55 
many of the if conditions needs to be worked upon but for instance like 20_000 or 1_00_000, these issues are solved for your reference . But for the cases like 200_200_000, you still need to work around.please see the attached code which rectifies your problem for given cases 20_000 or likewise.

Hope this proves to be helpful
C#
Console.WriteLine(DateTime.Now);
            Console.WriteLine("Welcome To Ayoola's Number Converter");
            string[] units = new string[] { " ", "ONE ", "TWO ", "THREE ", "FOUR ", "FIVE ", "SIX ", "SEVEN ", "EIGHT ", "NINE ", "TEN ", "ELEVEN ", "TWELVE ", "THIRTEEN ", "FOURTEEN ", "FIFTEEN ", "SIXTEEN ", "SEVENTEEN ", "EIGHTEEN ", "NINETEEN " };
            string[] tens = new string[] { " ", "TEN ", "TWENTY ", "THIRTY ", "FOURTY ", "FIFTY ", "SIXTY ", "SEVENTY ", "EIGHTY ", "NINETY " };
            string[] big = new string[] { "hundred ", "Thousand ", "million", "billion" };
            long i, num;
           
            while (true)
            {
                string result = "";
                Console.WriteLine("Enter number here : ");
                String input = Console.ReadLine();
                num = long.Parse(input);
                if (num < 1000000000000 && num > 99999999999)
                {
                    i = num / 100000000000;
                    result = units[i] + "HUNDRED " + "AND ";
                    num = num % 100000000000;
                }
                if (num > 19999999999 && num < 100000000000)
                {
                    i = num / 10000000000;
                    result += tens[i];
                    num = num % 10000000000;
                }
                if (num > 999999999 && num < 20000000000)
                {
                    i = num / 1000000000;
                    result += units[i] + "BILLION ";
                    num = num % 1000000000;
                }
                if (num > 99999999 && num < 1000000000)
                {
                    i = num / 100000000;
                    num = num % 100000000;
                    if (num != 0) { result += units[i] + "HUNDRED " + "AND "; }
                    else { result += units[i] + "HUNDRED " + "MILLION "; }
                   
                    
                }
                if (num >= 20000000 && num < 100000000)
                {
                    i = num / 10000000;
                    result += tens[i];
                    num = num % 10000000;
                }
                if (num >= 1000000 && num < 20000000)
                {
                    i = num / 1000000;
                    result += units[i] + "MILLION ";
                    num = num % 1000000;
                }
                if (num >= 100000 && num < 1000000)
                {
                    i = num / 100000;
                    num = num % 100000;
                    if(num != 0) { result += units[i] + "HUNDRED " + "AND "; }
                    else { result += units[i] + "HUNDRED " + "THOUSAND "; }
                    
                    
                }
                if (num > 19999 && num < 100000)
                {
                    i = num / 10000;
                    result += tens[i];
                    num = num % 10000;
                    if(num == 0)
                    {
                        result += "THOUSAND";
                    }
                }
                if (num > 999 && num <= 19999)
                {
                    i = num / 1000;
                    result += units[i] + "THOUSAND ";
                    num = num % 1000;
                }
                if (num > 99 && num < 1000)
                {
                    i = num / 100;
                    result += units[i] + "HUNDRED " + "AND ";
                    num = num % 100;
                }
                if (num > 19 && num < 100)
                {
                    i = num / 10;
                    result = result + tens[i];
                    num = num % 10;
                }
                if (num < 20 && num >= 0)
                { result += units[num]; }
                if (num == 0)
                    result += "";
                Console.WriteLine("The number in words: " + result);
}


modified 26-Jan-17 4:03am.

QuestionHow to save values in table in SQL without crashing when it is used by multiple users Pin
TarunKumarSusarapu22-Jan-17 21:49
professionalTarunKumarSusarapu22-Jan-17 21:49 
AnswerRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
Afzaal Ahmad Zeeshan22-Jan-17 23:43
professionalAfzaal Ahmad Zeeshan22-Jan-17 23:43 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
TarunKumarSusarapu23-Jan-17 0:44
professionalTarunKumarSusarapu23-Jan-17 0:44 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
Afzaal Ahmad Zeeshan23-Jan-17 1:08
professionalAfzaal Ahmad Zeeshan23-Jan-17 1:08 
AnswerRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
Simon_Whale23-Jan-17 0:27
Simon_Whale23-Jan-17 0:27 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
TarunKumarSusarapu23-Jan-17 0:45
professionalTarunKumarSusarapu23-Jan-17 0:45 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
Pete O'Hanlon23-Jan-17 0:46
mvePete O'Hanlon23-Jan-17 0:46 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
Simon_Whale23-Jan-17 0:47
Simon_Whale23-Jan-17 0:47 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
TarunKumarSusarapu23-Jan-17 0:54
professionalTarunKumarSusarapu23-Jan-17 0:54 
SuggestionRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
Richard Deeming23-Jan-17 3:17
mveRichard Deeming23-Jan-17 3:17 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
TarunKumarSusarapu23-Jan-17 18:10
professionalTarunKumarSusarapu23-Jan-17 18:10 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
TarunKumarSusarapu23-Jan-17 18:57
professionalTarunKumarSusarapu23-Jan-17 18:57 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
Richard Deeming24-Jan-17 2:05
mveRichard Deeming24-Jan-17 2:05 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
TarunKumarSusarapu24-Jan-17 0:24
professionalTarunKumarSusarapu24-Jan-17 0:24 
AnswerRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
Gerry Schmitz23-Jan-17 8:39
mveGerry Schmitz23-Jan-17 8:39 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
TarunKumarSusarapu23-Jan-17 18:13
professionalTarunKumarSusarapu23-Jan-17 18:13 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
Gerry Schmitz23-Jan-17 19:07
mveGerry Schmitz23-Jan-17 19:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.