Hi my question is how do I display all the numbers in my 2 dimensional array. I only manage to display the total sum of all the number of my array. If you could help me I be very thankful.
int[,] A = new int[5, 7];
Random rand = new Random();
private void SumAll(int[,] array)
{
int sum = 0;
int rows = array.GetLength(0);
int cols = array.GetLength(1);
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
array[i, j] = rand.Next(-100, 100);
sum += array[i, j];
richTextBox1.AppendText(array[i, j] + "Sum is: " + sum);
}
}
richTextBox1.Text = (sum.ToString());
}