Created
October 26, 2016 13:55
-
-
Save yvan-sraka/40bd5db6153531210bb652c5563ebf40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Triangle | |
* | |
* INPUT: | |
* - a number N | |
* | |
* OUPUT: (eg for N=5) | |
* # | |
* ## | |
* ### | |
* #### | |
* ##### | |
* | |
*/ | |
function Line(N) { | |
return "#".repeat(N); | |
} | |
function Triangle(N) { | |
for (var i = 1; i <= N; ++i) { | |
console.log(Line(i)); | |
} | |
} | |
Triangle(5); | |
Triangle(3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment