Reputation: 41
Can someone help to find out what I'm doing wrong here thanks.:) It seems to be going wrong in the for loop as I can't recall the values even outside the loop. So I don't think it's storing the values but I just can't seem to find what the problem is.
import java.lang.Math;
class Calculator {
public static void main(String[]args)
{
int range = 20;
int max=(range/2)
int min=((-range)/2);
int x = 0;
int y = 1;
int j = min;
int[][] table = new int[range][2];
for(int i = 0 ; i == range ; i++ )
{
//X coordinate
table[i][x] = 2*j;
System.out.println("X="+table[i][x]);
//Y coordinate
table[i][y] = j;
System.out.println("Y="+table[i][y]);
j++;
}
}
}
Upvotes: 0
Views: 309
Reputation: 4264
It should be for(int i = 0 ; i < range ; i++ )
Basically the loop doesn't execute because i != range at the start.
Upvotes: 3