0
How can I print the star in a Pyramid Shape in JS. When my code runs it show all stars in one line.How can resolve it?
(Here is my code) function piramid() { var rows=5; for(var i=1;i<=rows;i++) { for(var j=i;j<=rows;j++) { document.write(""); } for(var k=1;k<=i;k++) { document.write("*"); document.write(""); } document.write("\n"); } } piramid();
2 Respuestas
0
Use in last document.write this one:
document.write("<pre>\n<\/pre>");
0
Ok...Thanks but my same
Its prints a triangle right now not pyramid....