Skip to content

Commit

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

}
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 a639565

Please sign in to comment.