I want to print a triangl. I am getting my expected result but it's printing in consecutive lines. I want to print the "*" sideways for every for loop's output. How do I do it?
Code:
let a,b,c;
a = 5;
b = 1;
while(b <= a){
for(c=1;c<=b;c++){
console.log('*');
}
b++;
console.log('\n')
}
Output
Aucun commentaire:
Enregistrer un commentaire