brdzga
✅ I can't understand
int[] array1 = new int[4];
array1[0] = 1;
array1[1] = 4;
array1[2] = 8;
array1[3] = 3;
int[] array2 = new int[4];
array2[0] = 4;
array2[1] = 12;
array2[2] = 7;
array2[3] = 4;
int[] array3 = new int[3];
for (int i = 0; i < array1.Length; i++)
{
array3[i] = array1[i] + array2[array2.Length - 1 - i];
Console.WriteLine(array3[i]);
}
i was given assignment and this for function is basically the answer that i couldnt do and made chatgpt make it, can someone explain to me how does the code inside for function work? (i was assigned to make for function sum up the first and last, second and third, etc element of array1 and array2)
37 replies