NODE 写了一个菱形块
max=10mid=parseInt(max/2)
for(var x=1;x<max;x++){
for(var y=1;y<=max+(mid-x)*(Math.pow(-1,parseInt(x/mid)))*2-1;y++){
process.stdout.write(" ");
}
for(var k=Math.abs(mid-x);k<(max-1-Math.abs(mid-x));k++){
process.stdout.write(x.toString()+" ");
}
process.stdout.write("\n");
}
/*
PS E:\wp> node app15
1
2 2 2
3 3 3 3 3
4 4 4 4 4 4 4
5 5 5 5 5 5 5 5 5
6 6 6 6 6 6 6
7 7 7 7 7
8 8 8
9
PS E:\wp>
*/
页:
[1]