# Thread: Help with arrays and matrices!

1. Member
Join Date
Feb 2013
Posts
4
Rep Power
0

## Help with arrays and matrices!

I need to multiply two matrices. One has the values interger 0-10 where the values were created randomly and the other one has double values. Both are the same size of 5x31. If I go ahead and print them they look like they have been generated right. This is what I have so far.

Java Code:
```i = preciomatriz.length;
j = ranarray.length;
for(x=0; x<i; x++){
for(y=0; y<=j; y++){
for ( z=0; z<=j; z++) {
ventasxdia[x][y] += (double)(preciomatriz[x][z]*ranarray[z][y]);
System.out.println(ventasxdia[x][y]+" ");
}
}
}```
If there is an easier approach to this let me know. I've been looking around for a bit and i can't get it to work! Thanks in advance!

2. Member
Join Date
Nov 2012
Posts
29
Rep Power
0

## Re: Help with arrays and matrices!

idk about a way to do this, but looks to me that 5x31 and 5x31 matrices wouldn't normally multiple with each other. 5x31 and 31x5 would, because rows of 1st= columns of 2nd. if this is different in arrays, my apologies.

3. Member
Join Date
Feb 2013
Posts
4
Rep Power
0

## Re: Help with arrays and matrices!

That's what i was thinking too, but there were some examples I found were people would do it directly how I just stated. Thanks for the response though!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•