/ Patterns / pattern_13.java
pattern_13.java
 1  /* 
 2   * Write code to print the following patttern 
 3   * 1 0 1 0 1
 4   * 0 1 0 1 0
 5   * 1 0 1 0 1
 6   * 0 1 0 1 0
 7   * 1 0 1 0 1
 8   */ 
 9  
10  public class pattern_13 {
11    public static void main(String[] args) {
12      int n = 5; 
13  
14      for (int i = 1; i <= n; i++) {
15        for(int j = 1; j <= n; j++) {
16          System.out.print((i + j) % 2);
17          System.out.print(" ");
18        }
19        System.out.println();
20      }
21    }
22  }