# Having trouble multiplying these arrays...

• 03-30-2011
UCFuser
Having trouble multiplying these arrays...
This is really the only segment of code that matters

Code:

```for (i=0; i<length; i++) {         for (c=0; c<length; c++) {             product[i] = a[i]*a[c];         }     }```
I'm trying to multiply the arrays by each other (for example if the array a is [4,6,8] and array b is [5, 7,9] then I want the product array to = [4x5, 6x7, 8x9])
But it is multiplying them some other way and when I try to do it by hand I only get the answer I think is right , not the one the computer gives. If the rest of the program would help I can post that too thanks.
• 03-30-2011
CommonTater
Quote:

Originally Posted by UCFuser
This is really the only segment of code that matters

Code:

```for (i=0; i<length; i++) {         for (c=0; c<length; c++) {             product[i] = a[i]*a[c];         }     }```
I'm trying to multiply the arrays by each other (for example if the array a is [4,6,8] and array b is [5, 7,9] then I want the product array to = [4x5, 6x7, 8x9])
But it is multiplying them some other way and when I try to do it by hand I only get the answer I think is right , not the one the computer gives. If the rest of the program would help I can post that too thanks.

Code:

```for (i=0; i<length; i++)     product[i] = a[i]*b[i];```
• 03-30-2011
UCFuser
Haha well I guess that was pretty simple thanks
• 03-30-2011
CommonTater
Quote:

Originally Posted by UCFuser
Haha well I guess that was pretty simple thanks

The really cool stuff usually is....