Hello :) I am novice programmer, please help me with the error "Index was out of bounds of the array" I think I am taking into consideration that the value that I am trying to use as my lcv is higher than that of the size of the array. I would really appreciate simplicity in the solution.
static void Main(string[] args)
{
Console.WriteLine("enter a number");
/**********************************************************/
string inputString = Console.ReadLine();
int inputNum;
int.TryParse(inputString, out inputNum);
int[] divisorsArray = new int[inputNum -2];
int[] filteredArray = new int[] { };
int divisor = 1;
int yum = 0;
/**********************************************************/
for (int i = 0; i < inputNum -2; i++)
{
if ( divisor != inputNum && inputNum % divisor == 0)
divisorsArray[i] = divisor;
Console.WriteLine(divisorsArray[i]);
divisor++;
if (divisorsArray[i]>0)
{
filteredArray[yum] = divisorsArray[i];
yum++;
}
}
Console.ReadKey();
}