So I've been giving a number of assignments to do but I'm stuck on one in particular now. I've to create a 2D array ([5][2]) and then say how many times ou of the 5 rows that the first row was bigger than the second. I imagined I would need a counter and that it would go something like below but depending on where I print the result it comes out as either 2 or 7....when of course, it isn't 2 or 7 :P I have the array decalred in the main method and all that, just this part I'm stuck on. Thanks for any help.
Prosper92.
static void Won(int s[][])
{
int counter = 0;
for(int r=0; r<s.length; r++)
{
counter = 0;
for(int c=0; c<s[0].length; c++)
{
if(r>c)
{
counter++;
}
}
}
System.out.println(counter);
}