Below Code With Demo
* ** *** **** ****
let n = 5;let string = "";for (let i = 1; i <= n; i++) {// printing spacesfor (let j = 0; j < n - i; j++) {string += " ";}// printing starfor (let k = 0; k < i; k++) {string += "*";}string += "\n";}console.log(string);
No comments:
Post a Comment