+ 1
I am confused with output of this code. Can someone please explain. Thanks
public class Program { public static void main(String[] args) { for (int i = 1; i <= 5; i++) { for (int j = 1; j <= 3; j++) if (j == 1 && (i % 4) == 1) System.out.print("W"); else if (j > 1 && (i + j) % 2 ==1) System.out.print("W"); else System.out.print("."); System.out.println(); } } }
4 Antworten
+ 1
It is better to code in the code playground and see the result
+ 1
I know the result which is:
WW.
..W
.W.
..W
WW.
How did it work?
0
OK tell me what do you want to make,
Give the question ❔ with example
I will make it for you.
0
How does the loop work? which loop works first? the inner loop or the outer loop.