Try:
String s = "";
for(int i = 0 ; i < nLines ; ++i) {
s = (i % 2 == 0 ? "1 " : "0 ") + s;
System.out.println(s);
}
solved Create triangle with “1” ” 0″ by for loop [closed]
Try:
String s = "";
for(int i = 0 ; i < nLines ; ++i) {
s = (i % 2 == 0 ? "1 " : "0 ") + s;
System.out.println(s);
}
solved Create triangle with “1” ” 0″ by for loop [closed]