Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. <script>
  2. let n = prompt("enter number", "");
  3. let col,row;
  4. for (row = 1; row <= n; row++){
  5. for (space = 1; space <= (n-row); space++){
  6. document.write("&nbsp");
  7. }
  8. for(col = 1; col <= row; col++)
  9. {
  10. document.write ("*" + " ");
  11. }
  12. document.write("<br>");
  13. }
  14.  
  15. for (row = 1; row <= n; row++){
  16. for (space = n; space >= (n-row); space--){
  17. document.write("&nbsp");
  18. }
  19. for(col = n-1; col >= row; col--)
  20. {
  21. document.write ("*" + " ");
  22. }
  23. document.write("<br>");
  24. }
  25. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement