hi every one i am very new to this and want a lil help with arrays ....
i need to know how to make operations like +,*,/,- on a 2D arrays lets say i have 3 arrays each of them is [3,3] .. how i can + them all making a 4th array from the result ??
my code is:
class Program
{
static void Main(string[] args)
{
int[,] A = new int[3,3]
{
{3,5,6},
{3,4,4},
{3,4,5}
};
int[,] B = new int[3,3]
{
{4,5,6},
{2,7,8},
{1,4,0}
};
int[,] C = new int[3,3]
{
{3,5,6},
{2,7,6},
{1,6,9}
};
int[,] Y = new int[3, 3];
Y = (A + B + C);
{
for (int i = 0; i <= Y.GetUpperBound(0); i++)
{
int s1 = Y[i, 0];
int s2 = Y[i, 1];
int s3 = Y[i, 2];
Console.WriteLine("{0}, {1}, {2}", s1, s2, s3);
}
Console.WriteLine("Matrix B");
}
Console.Read();
}
}
}
but i always get this error msg :
Operator '+' cannot be applied to operands of type 'int[*,*]' and 'int[*,*]'
so plz i need help
sorry again if my question is a very low level one i just started
thx for the help
i need to know how to make operations like +,*,/,- on a 2D arrays lets say i have 3 arrays each of them is [3,3] .. how i can + them all making a 4th array from the result ??
my code is:
class Program
{
static void Main(string[] args)
{
int[,] A = new int[3,3]
{
{3,5,6},
{3,4,4},
{3,4,5}
};
int[,] B = new int[3,3]
{
{4,5,6},
{2,7,8},
{1,4,0}
};
int[,] C = new int[3,3]
{
{3,5,6},
{2,7,6},
{1,6,9}
};
int[,] Y = new int[3, 3];
Y = (A + B + C);
{
for (int i = 0; i <= Y.GetUpperBound(0); i++)
{
int s1 = Y[i, 0];
int s2 = Y[i, 1];
int s3 = Y[i, 2];
Console.WriteLine("{0}, {1}, {2}", s1, s2, s3);
}
Console.WriteLine("Matrix B");
}
Console.Read();
}
}
}
but i always get this error msg :
Operator '+' cannot be applied to operands of type 'int[*,*]' and 'int[*,*]'
so plz i need help
sorry again if my question is a very low level one i just started

thx for the help

int[,] a = new int[3, 3] { { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 } };
int[,] b = new int[3, 3] { { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 } };
int[,] c = new int[3, 3] { { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 } };
int[,] result = new int[3, 3];
for (int i = 0; i < 3; i++)
{
for (int k = 0; k < 3; k++)
{
result[i, k] = a[i, k] + b[i, k] + c[i, k];
}
}
int[,] b = new int[3, 3] { { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 } };
int[,] c = new int[3, 3] { { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 } };
int[,] result = new int[3, 3];
for (int i = 0; i < 3; i++)
{
for (int k = 0; k < 3; k++)
{
result[i, k] = a[i, k] + b[i, k] + c[i, k];
}
}