+ 15
Why the array goes to 14 ¿? Зашто низ иде до 14 ¿?
3 odpowiedzi
+ 14
Code is different in "code vu0063 i vu0064"
Код је другачији у " коду vu0063 i vu0064"
+ 2
for (int k = 0; k < 8; k++) {
a[k] = k*2;
}
So this for loop wil run 8 times. Each time it will fill array with number -- k*2.
k = 0, a[0] = 0 (0*2)
k = 1, a[1] = 2 (1*2)
k = 2, a[2] = 4 (2*2)
k = 3, a[3] = 6 (3*2)
k = 4, a[4] = 8 (4*2)
k = 5, a[5] = 10 (5*2)
k = 6, a[6] = 12 (6*2)
k = 7, a[7] = 14 (7*2)
+ 1
try to remove duplicate code. the second for loop can be deleted and simply insert Console.WriteLine(a[k]);
after the a [k]=k*2; in the first for loop. works the same