Skip to content

Commit

Permalink
Merge pull request #102 from malyabansalper/malya/hacktoberfest-contr…
Browse files Browse the repository at this point in the history
…ibution

Pyramid Pattern HacktoberFest2022
  • Loading branch information
fineanmol authored Oct 1, 2022
2 parents b363456 + c7c59c8 commit 290c02b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/pyramid_pattern_malyabansalper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
let n = 5;
let string = "";
// External loop
for (let i = 1; i <= n; i++) {
// printing spaces
for (let j = 1; j <= n - i; j++) {
string += " ";
}
// printing star
for (let k = 0; k < 2 * i - 1; k++) {
string += "*";
}
string += "\n";
}
console.log(string);

0 comments on commit 290c02b

Please sign in to comment.