Skip to content

Commit

Permalink
code to print the inverted triangle
Browse files Browse the repository at this point in the history
Program to print inverted triangle
  • Loading branch information
Arunkumar1712 authored Jan 8, 2024
1 parent a639565 commit 429c4c4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions invertedtriangle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var n=5;
var str="";
for(var i=n;i>0;i--){
for(var j=0;j<n-i;j++){
str+=" ";
}
for(var k=2*i-1;k>0;k--){
str+="*";
}
str+="\n";
}
console.log(str)

0 comments on commit 429c4c4

Please sign in to comment.