As a user I have to input the size of an array and then fill it. For example if I input n=2,then first element =3,second =2 I need to calculate (X-3)(X-2). For this example output has to be 1,-5,6 ( cause (X-3)(X-2) = x^2 - 5*x + 6). I have no idea how to actually extract those coefficients.Do I have to work as if it was a string line? And how do I actually get to this expression "x^2 - 5*x + 6"? This is a piece of code that I have, but it just filling of the array
Console.WriteLine( "Enter size of an array" );
int size;
Int32.TryParse(Console.ReadLine(), out size);
var firstVector = new string[size];
Console.WriteLine("Input first vector:");
for (var i = 0; i <size; i++)
{
firstVector[i] = Console.ReadLine();
}
int[] firstVecInt = Array.ConvertAll(firstVector, int.Parse);
Console.WriteLine("======================");
foreach (var item in firstVecInt)
{
Console.Write(item.ToString() + " ");
}
Console.WriteLine(" first vector");
for( var i =0; i< size;i++)
{
Console.Write("(x-" + firstVecInt[i] +")*");
}
Console.WriteLine("polynomial");