Advertisement
x2311

Untitled

Jun 14th, 2021
799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Богдан Пархоменко
  2. //https://zero.p2p.shpp.me/tasks/3_5_christmas_tree.html
  3.  
  4. let tree = +prompt("розмір ялинки: ");
  5.  
  6. for (let space = tree - 1, star = 1; tree > 0; space-- , tree-- , star += 2) {
  7.     for (let Auxiliary_variable1 = space; Auxiliary_variable1 > 0; Auxiliary_variable1--){
  8.         console.put(" ");
  9.     }
  10.     for (let Auxiliary_variable2 = star; Auxiliary_variable2 > 0; Auxiliary_variable2--){
  11.         console.put("*");
  12.     }
  13.     if (tree == 1) {
  14.         console.log();
  15.         while (star - 1 > 0) {
  16.             console.put(" ");
  17.             star -= 2;
  18.         }
  19.         console.put("*");
  20.     }
  21.     console.log();
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement