The code is supposed to multiply a matrix by a scalar value and then print it out to the Matrix to the Console....
I know that a double Array is used and then each of the values of a is multiplied by b....
What does the code do after the a*= b; line?
Is StringWriter some type of a function and strOut is the name of it? (Also, there is some type of error in the code, can you identify it?). Thanks in advance.
static void Main() {
double[,] a;
a = new double[,] { { 1, 2, 5 }, { 7, -3, 8 } };
double b = 2.3;
a *= b;
StringWriter strOut = new StringWriter();
strOut.Write("Matrix is:");
for (int i = 0; i < a.GetLength(0); i++)
{
strOut.WriteLine();
for (int j = 0; j < a.GetLength(1); j++)
{
strOut.Write("{0,9:f3}", a[i, j]);
}
}
Console.WriteLine(strOut.ToString());
}