Day 44: Pattern using loops of 100DaysCodingChallenge
Hello all,
#day44
Day44
Today's my task was to Print the below Pattern using loops.
Solid Rectangular star
* * * * *
* * * * *
* * * * *
I have started the 100 days of coding challenge to improve my programming skills..
Code :
let a = prompt("Enter a Number : ");
let string = ""; 
let max = Math.ceil(a/2);
function solidRect(a) {
  //let string;
  for (let i = 1; i <= max; i++) {
    //let string;
    for (let j = 1; j <= a; j++) {
      //min = i < j ? i : j;
      string += "* ";
    }
    string += "\n";
  }
  console.log(string);
}
solidRect(a);Output :
Happy Coding:)
Thank you...

 
 
 
Comments
Post a Comment