Day 52: Pattern using loops of 100DaysCodingChallenge
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:)
Thank you...
Comments
Post a Comment