Hello i've got a easy programming task in C# but im stuck on the last part. I need to make 2 arrays that have random numbers (3x3) and on the end i need to sum them up in one number. So its: array1 with 3 numbers + array2 with 3 numbers = array3 with all the array numbers addition. Can somebody please help me? My code is:
static void Main(string[] args)
{
int[,] pole1 = new int[3, 3];
int[,] pole2 = new int[3, 3];
int[,] pole3 = new int[3, 3];
Random random1 = new Random();
Console.WriteLine("Pole 1 je: ");
for (int a = 0; a <= 2; a++)
{
for (int b = 0; b <= 2; b++)
{
pole1[a, b] = random1.Next(1, 9);
Console.Write(pole1[a, b]);
}
Console.WriteLine();
}
Console.WriteLine("Pole 2 je: ");
for (int a = 0; a <= 2; a++)
{
for (int b = 0; b <= 2; b++)
{
pole2[a, b] = random1.Next(1, 9);
Console.Write(pole2[a, b]);
}
Console.WriteLine();
}
Console.WriteLine("Součet polí je: ");
for (int a = 0; a <= 2; a++)
{
for (int b = 0; b <= 2; b++)
{
pole3[a, b] = (pole1[a, b] + pole2[a, b]);
Console.Write(pole3[a, b]);
}
Console.WriteLine();
}
Console.ReadKey();
}
}
I've got the two arrays but idk how to sum them up.

