pattern(1's and 0's)
package code.mypack;
public class src {
public static void main(String[] args) {
for (int i = 1; i <= 5; i++) {
for (int j = 1; j <= i; j++) {
if ((i + j) % 2 == 0) {
System.out.print(1);
} else {
System.out.print(0);
}
}
System.out.println();
}
}
}
Comments
Post a Comment