when i trace the code im getting 1,3,5,7 for the answer but the compiler prints 1,3,6,10
im having trouble understanding how this happens could anyone explain
int [] a= new int[5];
for (int i =1; i<=4; i++)
{
a[i]=a[i-1]+i;
System.out.print(a[i]+" ");
}