Posts

Day 53: Pattern using loops of 100DaysCodingChallenge

Image
Hello all,  #day53  Day53  Today's my task was to Print the below Pattern using loops. Full Pyramid of Numbers 1 2 2 2 3 3 3 3 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 I have started the 100 days of coding  challenge  to improve my programming skills.. Code :  let a = prompt("Enter a number : "); let string = ""; function full(a) { let k = 1; for (let i = 0; i <= a; i++) { //console.log('j1', a - i); for (let j = 2 * (a-i); j >= 0 ; j--) { //console.log('j1', j); string += " "; } //console.log('j2', i - k); for (let j = 2 * (i - k); j >= 0; j--) { //console.log('j2', j); string += i+" "; } string += "\n"; } console.log(string); } full(a); Output :         Happy Coding:) Day 53 Of 100 Days Coding Challenge Thank you...     

Day 52: Pattern using loops of 100DaysCodingChallenge

Image
Hello all,  #day52  Day52  Today's my task was to Print the below Pattern using loops. Half Pyramid using Numbers Pattern 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5  I have started the 100 days of coding  challenge  to improve my programming skills.. Code :  let a = prompt("Enter a number : "); let string = ""; function half(a) { for (let i = 1; i <= a; i++) { for (let j = 1; j <= i; j++) { string += j+" "; } string += "\n"; } console.log(string); } half(a); Output :         Happy Coding:) Day 52 Of 100 Days Coding Challenge Thank you...     

Day 51: Pattern using loops of 100DaysCodingChallenge

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

Day 50: Pattern using loops of 100DaysCodingChallenge

Image
Hello all,  #day50  Day50  Today's my task was to Print the below Pattern using loops. Full Pyramid Star Pattern * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * I have started the 100 days of coding  challenge  to improve my programming skills.. Code :  let a = prompt("Enter a number : "); let string = ""; function full(a) { let k = 0; for (let i = a; i >= 0; i--) { //console.log('j1', a - i); for (let j = 2*(a-i); j >= 0 ; j--) { //console.log('j1', j); string += " "; } //console.log('j2', i - k); for (let j = 2*(i - k); j >= 0 ; j--) { //console.log('j2', j); string += "* "; } string += "\n"; } console.log(string); } full(a); Output :         Happy Coding:) Day 50 Of 100 Days Coding Challenge Thank you...     

Day 49: Pattern using loops of 100DaysCodingChallenge

Image
Hello all,  #day49  Day49  Today's my task was to Print the below Pattern using loops. Half Pyramid Star Pattern * * * * * * * * * * * * * * * I have started the 100 days of coding  challenge  to improve my programming skills.. Code :  let a = prompt("Enter a number : "); let string = ""; function full(a) { let k = 0; for (let i = 0; i < a; i++) { //console.log('j1', a - i); for (let j = 2*(a-i); j >= 0 ; j--) { //console.log('j1', j); string += " "; } //console.log('j2', i - k); for (let j = 2*(i - k); j >= 0 ; j--) { //console.log('j2', j); string += "* "; } string += "\n"; } console.log(string); } full(a); Output :         Happy Coding:) Day 49 Of 100 Days Coding Challenge Thank you...     

Day 48: Patterns Programs using loops of 100DaysCodingChallenge

Image
Hello all,  #day48  Day48  Today's my task was to Print the below Pattern using loops. Full Pyramid Star Pattern  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * I have started the 100 days of coding  challenge  to improve my programming skills.. Code :  let a = prompt("Enter a number : "); let string = ""; function full(a) { let k = 0; for (let i = 0; i < a; i++) { //console.log('j1', a - i); for (let j = 2*(a-i); j >= 0 ; j--) { //console.log('j1', j); string += " "; } //console.log('j2', i - k); for (let j = 2*(i - k); j >= 0 ; j--) { //console.log('j2', j); string += "* "; } string += "\n"; } console.log(string); } full(a); Output :         Happy Coding:) Day 48 Of 100 Days Coding Challenge Thank you...     

Day 47: Pattern using loops of 100DaysCodingChallenge

Image
Hello all,  #day47  Day47  Today's my task was to Print the below Pattern using loops. Hollow Rectangle Star Pattern * * * * * *             * *         * *         * * * * * * I have started the 100 days of coding  challenge  to improve my programming skills.. Code :  let a = prompt("Enter a number : "); let string = ""; let l = Math.ceil(a/2); function hollowRect(a) { for (let i = 1; i <= a; i++) { for (let j = 1; j <= a; j++) { if(i == 1 || i == a || j == 1 || j == a) { string += "* "; } else { string += " "; } //string += "*"; } string += "\n"; } console.log(string); } hollowRect(a); Output :         Happy Coding:) Day 47 Of 100 Days Coding Challenge Thank you...     

Day 46: Pattern using loops of 100DaysCodingChallenge

Image
Hello all,  #day46  Day46  Today's my task was to Print the below Pattern using loops. Hollow Full Pyramid Star Pattern * * * * * * * *********** I have started the 100 days of coding  challenge  to improve my programming skills.. Code :  let n = prompt("Enter a number : "); let string = ""; function hollow(n) { //let n = 5; let string = ""; // External loop for (let i = 1; i <= n; i++) { // printing spaces for (let j = 1; j <= n - i; j++) { string += " "; } // printing star for (let k = 1; k <= 2 * i - 1; k++) { if(i === 1 || i === n) { string += "*"; } else { if(i == n || k==1 || k==(2 * i - 1)) { string += "*"; } else { string += " "; } } } string += "\n"; } console.log(string); } hollow(n); Output :         Happy Coding:) Day 46 Of 100 Days Coding Challenge Thank you...    

Day 45: Pattern using loops of 100DaysCodingChallenge

Image
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:) Day 45 Of 100 Days Coding Challenge Thank you...    

Day 44: Pattern using loops of 100DaysCodingChallenge

Image
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:) Day 44 Of 100 Days Coding Challenge Thank you...