Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package loops;
- public class Nesting {
- public static void main(String[] args) {
- boolean startX=true;
- for(int i=0; i<8;i++){//iterate 10X
- for(int j=0;j<8;j++){//iterate 10x
- if(startX&&j%2==0){
- System.out.print("x");
- }else if(startX&&j%2!=0){
- System.out.print("o");
- }else if(!startX&&j%2==0){
- System.out.print("o");
- }else{
- System.out.print("x");
- }
- }
- startX=!startX;
- System.out.println();
- }
- /*xoxoxoxo
- oxoxoxox
- xoxoxoxo
- oxoxoxox
- xoxoxoxo
- oxoxoxox
- xoxoxoxo
- oxoxoxox
- */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement