Site Loader
Auckland, New Zealand
Here is the algorithm Here is the code snippet
        public static string PrimeFactorial(int number)
        {
            ArrayList returnNo = new ArrayList();
            string factors = null;
            for (int i = 2; i <= number; i++)
            {
                while (number % i == 0)
                {
                    returnNo.Add(i);
                    number = number / i;
                }
            }

            string output = null;
            for (int i = 0; i < returnNo.Count; i++)
            {
                output = output + string.Format("{0}{1}", returnNo[i].ToString(),"x");
                
            }
            Console.WriteLine(output);

            return factors;
        }

Thanks, Karthik KK

Post Author: Karthik kk

Leave a Reply

Your email address will not be published. Required fields are marked *