Advertisement
Guest User

Untitled

a guest
Jul 31st, 2021
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // https://zero.p2p.shpp.me/tasks/3_5_christmas_tree.html
  2. // https://pastebin.com/SL1zvbDD  предыдущее ревью
  3. let size = +prompt('Размер ёлочки')
  4. let row
  5. let space
  6. let star
  7. let counter = 0
  8. for(row = 0; row < size; row++) {
  9.     space = size - 1
  10.     star = 0
  11.     while (space > row) {  
  12.         console.put(' ')
  13.         space--  
  14.     }    
  15.     while (star <= row*2){
  16.         console.put('*')
  17.         star++    
  18.     }    
  19.     console.put('\n')    
  20. }
  21. while (counter < size - 1) {  
  22.         console.put(' ')
  23.         counter++  
  24.     }    
  25.         console.put('*')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement