Day 45: Pattern using loops of 100DaysCodingChallenge
Hello all,
#day45
Day45
Today's my task was to Print the below Pattern using loops.
Inverted Half Pyramid Pattern Star
* * * * * *
* * * * *
* * * *
* * *
* *
*
I have started the 100 days of coding challenge to improve my programming skills..
Code :
let a = prompt("Entera number : ");
let string = "";
function half(a) {
for (let i = a; i >= 0; i--) {
for (let j = i; j >= 0; j--) {
string += "* ";
}
string += "\n";
}
console.log(string);
}
half(a);Output :
Happy Coding:)
Thank you...

Comments
Post a Comment