if (shape.equals("diagonal")){
for (int row = 0; row <= size; row ++){
for (int col = 0 ; col < size; col ++ ){
if ( col % 4 == 0 ){
System.out.print("*");
} else {
System.out.print("$");
}
}
System.out.println();
}
}
*$$$*$$$*$$$*$$$*
$*$$$*$$$*$$$*$$$
$$*$$$*$$$*$$$*$$
same as it go down
我的目标是打印上面的代码并继续直到17乘17输出创建
答案 0 :(得分:1)
尝试替换
if (col % 4 == 0 )
与
if ( (col+row)%4 == 0 )