bacco

*JS* House

Mar 13th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function house([arge1]){
  2.     let n = Number(arge1);
  3.  
  4.     var a = Math.floor((n - 1) / 2);
  5.  
  6. for (i = 0; i < Math.floor((n + 1) / 2 ); i++) {
  7.     var b = n - a - a;
  8.     console.log("-".repeat(a) + "*".repeat(b) + "-".repeat(a) );
  9.     a--;
  10. }
  11. for (i = 0; i < n / 2; i++) {
  12.     console.log("|" + "*".repeat(n - 2) + "|" );
  13. }
  14. }
  15. house([8])
  16.  
  17. //                    ---**---
  18. //                    --****--
  19. //                    -******-
  20. //                    ********
  21. //                    |******|
  22. //                    |******|
  23. //                    |******|
  24. //                    |******|
Advertisement
Add Comment
Please, Sign In to add comment