Day 66: Pattern using loops of 100DaysCodingChallenge
Hello all,
#day66
Day66
Today's my task was to Print the below Pattern using loops.
Floyd's Triangle
1
2 3
4 5 6
7 8 9 10
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) { let n = 1; for (let i = 1; i < a; i++) { for (let j = 0; j < i; j++) { string += n+" "; n++; } string += "\n"; } console.log(string); } half(a);
Output :
Happy Coding:)
Thank you...
Comments
Post a Comment