I am designing a program that asks for the user to input 2 numbers. It then finds the prime factors of each number. The number of prime factors depends on what number the user inputs. I need an array whose number of elements isn't known ahead of time so that I can input the prime factors of one of the numbers into the array of variable length.
int a = -1, b = -1;
string sa, sb;
int GCF = 0;
int LCM = 0;
int temp = 1, tempb = 1;
int[] primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43,
47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
while (aValid == true)
{
for (int i = 0; i < 25; i++)
{
if (a % primes[i] == 0)
{
Console.Write(" ");
Console.Write(primes[i]);
//my attempt below to input current prime factor into variable array
int[] arrb = primes[i];
a = a / primes[i];
}
}
if (a == 1)
{
break;
}
}