Day 59: Pattern using loops of 100DaysCodingChallenge
Hello all,
#day59
Day59
Today's my task was to Print the below Pattern using loops.
Half Pyramid Pattern using Alphabets
A
A B
A B C
A B C D
A B C D E
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 += "* "; string += String.fromCharCode("A".charCodeAt(0) - 1 + j) +" "; } string += "\n"; } console.log(string); } half(a);
Output :
Happy Coding:)
Thank you...
Comments
Post a Comment