Multiple variables in a for loop

for-loop, java

Solution

The problem is the condition of the loop. The correct should be:

for(i=d+2,j=0;i<2d+3 && j<d;i++,j++){ ...

or

for(i=d+2,j=0;i<2d+3 || j<d;i++,j++){ ...

There is no meaning in putting a comma separating two boolean conditions in java.

And as seen in the comments, variables `j` and `i` are not declared.

Problem

``` else { r=Power(s,n-1); System.out.println(r); int d=r.length; char ch=s.charAt(n); int v=d+1; p[v]=Character.toString(ch); String q = p[v]; for(i=d+2,j=0;i<2d+3,j<d;i++,j++) { p[i]=r[j].concat(q); } } ``` A syntax error is shown and var j is not recognized even after declaration... pls help me.

Original source