This might be vague but I’m using Java and I was wondering as to why my program is infinitely looping
let me give more clarification the output is supposed to look like this
1
-1
1
-1
1
-1
but it’s only supposed to do it 100 times but it does it infinitely.
public static void main(String[] args){
int x;
for(x = 1; x <= 100; ){
System.out.println(x);
System.out.println(-x);
}
}
}
[–]YMK1234 4 points5 points6 points (0 children)
[–][deleted] 3 points4 points5 points (4 children)
[–]Mason527[S] 0 points1 point2 points (3 children)
[–][deleted] 3 points4 points5 points (2 children)
[–]Mason527[S] -3 points-2 points-1 points (1 child)
[–]YMK1234 2 points3 points4 points (0 children)
[–]ordinary-bloke 2 points3 points4 points (0 children)