/// <summary>
        /// this method will check number is prime or not if yes then check for Anagram.
        /// </summary>
        public static void PrimeAnagramNumbers()
        {
            try
            {
                ////Add prime numbers to list
                for (int i = 2; i < 1000; i++)
                {
                    if (Utility <int> .Prime(i) == 0)
                    {
                        PrimeList.Add(i);
                    }
                }

                ////Add anagram numbers to list
                for (int i = 0; i < PrimeList.Count; i++)
                {
                    for (int j = i + 1; j < PrimeList.Count; j++)
                    {
                        if (Utility <int> .Anagram(PrimeList[i], PrimeList[j]))
                        {
                            AnagramNumberList.Add(PrimeList[i]);
                        }
                    }
                }

                AnagramNumberList.Sort();

                ////calling to store Element function
                PrimeAnagram2DArray.StoreElement();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
 /// <summary>
 /// call to the Prime anagram function.
 /// </summary>
 public static void PrimeAnagramFunction()
 {
     try
     {
         Console.WriteLine("Prime Anagram Numbers 0-1000 :");
         PrimeAnagram2DArray.PrimeAnagramNumbers();
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
Пример #3
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public static void Main(string[] args)
        {
            try
            {
                char ans;
                do
                {
                    Console.WriteLine("1.Linked List Operations For String ");
                    Console.WriteLine("2.Linked List Operations For Integer ");
                    Console.WriteLine("3.Balanced Parenthesis ");
                    Console.WriteLine("4.Bank Cash Counter ");
                    Console.WriteLine("5.Calender");
                    Console.WriteLine("6.Palindrome Checker");
                    Console.WriteLine("7.Prime number 2D array");
                    Console.WriteLine("8.Prime Anagram number 2D array");
                    Console.WriteLine("9.Prime Anagram numbers using Stack");
                    Console.WriteLine("10.Prime Anagram numbers using Queue");
                    Console.WriteLine("11.Number of Binary Search Trees");
                    Console.WriteLine("12.Hashing Array");

                    int ch = Convert.ToInt32(Console.ReadLine());
                    switch (ch)
                    {
                    case 1:
                        ReadIntoLinkedList <string> b = new ReadIntoLinkedList <string>();
                        break;

                    case 2:
                        ReadIntegerFromFile <int> b1 = new ReadIntegerFromFile <int>();
                        b1.OrderedListOperation();
                        break;

                    case 3:
                        BalanceParenthesis b2 = new BalanceParenthesis();
                        b2.CheckBalancedParenthesis();
                        break;

                    case 4:
                        BankCashCounter bcc = new BankCashCounter();
                        bcc.BankCashCounterOperations();
                        break;

                    case 5:
                        Calendar.DisplayCalendar();
                        break;

                    case 6:
                        PalindromeChecker pc = new PalindromeChecker();
                        pc.PalindromeCheckMethod();
                        break;

                    case 7:
                        Prime2DArray.Prime2DOperation();
                        break;

                    case 8:
                        PrimeAnagram2DArray.PrimeAnagramFunction();
                        break;

                    case 9:
                        PrimeAnagramNumberUsingStack ps = new PrimeAnagramNumberUsingStack();
                        ps.PrintPrimeAnagram();
                        break;

                    case 10:
                        PrimeAnagramNumberUsingQueue pq = new PrimeAnagramNumberUsingQueue();
                        pq.PrintPrimeAnagram();
                        break;

                    case 11:
                        InputBinary.BinaryTree();
                        break;

                    case 12:
                        InputForHashing input = new InputForHashing();
                        input.CallHashingFunction();
                        break;

                    default:
                        Console.WriteLine("Invalid Choice...");
                        break;
                    }

                    Console.WriteLine("\nDo you want to continue in Menu (y/n) : ");
                    ans = Convert.ToChar(Console.ReadLine());
                }while (ans == 'Y' || ans == 'y');
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.WriteLine("Thank you...");
        }