The first element in the first loop must be added to the first element in the second loop.
The combined values must be in a third array. This is the Sum array.
int[][] arr = new int[2][];
int[] Sum;
arr[0] = new int[5] { 11, 32, 15, 17, 92 };
arr[1] = new int[4] { 2, 4, 6, 8 };
//Display the array elements
for (int i = 0; i < arr.Length; i++)
{
Sum = arr[0][i] + arr[1][i];
System.Console.WriteLine("Sum of the two Arrays: {0}", Sum);
System.Console.WriteLine("Element({0}); ", i);
for (int j = 0; j<arr[i].Length; j ++)
{
System.Console.WriteLine("{0}{1}", arr[i][j], j == (arr[i].Length - 1) ? "" : " ");
}
System.Console.WriteLine();
}
ModEdit: Fix your code tags

New Topic/Question
Reply




MultiQuote







|