Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function house([arge1]){
- let n = Number(arge1);
- var a = Math.floor((n - 1) / 2);
- for (i = 0; i < Math.floor((n + 1) / 2 ); i++) {
- var b = n - a - a;
- console.log("-".repeat(a) + "*".repeat(b) + "-".repeat(a) );
- a--;
- }
- for (i = 0; i < n / 2; i++) {
- console.log("|" + "*".repeat(n - 2) + "|" );
- }
- }
- house([8])
- // ---**---
- // --****--
- // -******-
- // ********
- // |******|
- // |******|
- // |******|
- // |******|
Advertisement
Add Comment
Please, Sign In to add comment