static void Main(string[] args) { String number = Console.ReadLine(); if (number.Length == 1) { Console.WriteLine(Digit.onedigit(Int32.Parse(number))); } else if (number.Length == 2) { Console.WriteLine(Digit.twodigit(Int32.Parse(number))); } else if (number.Length == 3) { Console.WriteLine(Digit.threedigit(Int32.Parse(number))); } else if (number.Length == 4) { Console.WriteLine(Digit.fourdigit(Int32.Parse(number))); } else if (number.Length == 5) { Console.WriteLine(Digit.fivedigit(Int32.Parse(number))); } else if (number.Length == 6) { Console.WriteLine(Digit.sixdigit(Int32.Parse(number))); } else { Console.WriteLine("Enter Number Only"); } Console.WriteLine("Press Enter For Exit..."); Console.ReadLine(); }
//Generate for six digit public static String sixdigit(int number) { int[] n = new int[6]; int i = 5; String temp; Stack <String> s = new Stack <String>(); n = seperateDigit(number, n, i); if (0 == n[1] && 0 == n[2] && 0 == n[3] && 0 == n[4] && 0 == n[5]) { s.Push("Lakh"); temp = Digit.onedigit(n[0]); s.Push(temp); } else if (0 == n[1] && 0 != n[2] && 0 != n[3] && 0 != n[4] && 0 != n[5]) { int t; t = (n[2] * 1000) + (n[3] * 100) + (n[4] * 10) + n[5]; temp = Digit.fourdigit(t); s.Push(temp); s.Push("Lakh"); temp = Digit.onedigit(n[0]); s.Push(temp); } else if (0 == n[1] && 0 == n[2] && 0 != n[3] && 0 != n[4] && 0 != n[5]) { int t; t = (n[3] * 100) + (n[4] * 10) + n[5]; temp = Digit.threedigit(t); s.Push(temp); s.Push("Lakh"); temp = Digit.onedigit(n[0]); s.Push(temp); } else if (0 == n[1] && 0 == n[2] && 0 == n[3] && 0 != n[4] && 0 != n[5]) { int t; t = (n[4] * 10) + n[5]; temp = Digit.twodigit(t); s.Push(temp); s.Push("Lakh"); temp = Digit.onedigit(n[0]); s.Push(temp); } else if (0 != n[0] && 0 == n[1] && 0 == n[2] && 0 == n[3] && 0 == n[4] && 0 != n[5]) { temp = Digit.onedigit(n[5]); s.Push(temp); s.Push("Lakh"); temp = Digit.onedigit(n[0]); s.Push(temp); } else { int t; t = (n[1] * 10000) + (n[2] * 1000) + (n[3] * 100) + (n[4] * 10) + n[5]; temp = Digit.fivedigit(t); s.Push(temp); s.Push("Lakh"); temp = Digit.onedigit(n[0]); s.Push(temp); } temp = popalldata_Stack(s); return(temp); }