Why do I get an error on Input out of range exception?
===

    int bNum=3;
    int aNum=3;
    for (int i = 0; i < bNum; i++)
            {
                for (int j = 0; j < aNum; j++)
                {
                    b[i] += a[j];
                    b[i + 3] += a[j + 3];
                    b[i + 6] += a[j + 6];
                }
            }

I basically want the following to happen:

    b[0]=a[0]+a[1]+a[2];
    b[1]=a[3]+a[4]+a[5];
    b[2]=a[6]+a[7]+a[8];

What is wrong with my logic?

HAHA! OOPS! My sleepy eyes are accounting for the dumb question. I see that at every iteration it get computed multiple times.