Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://shpp.gitbook.io/zero/tutorials/loops/christmas_tree
- let size = +prompt("Введіть розмір ялинки");
- let i = 0;
- while (i < size - 1) {
- let star = "*", space = "";
- let j = size;
- while (j > i + 2) {
- space += " ";
- j--;
- }
- j = 0
- while (j < i) {
- star += "**";
- j++;
- }
- console.log(space + star);
- i++
- }
- let space = "";
- i = 0;
- while (i < size - 2) {
- space += " ";
- i++;
- }
- console.log(space + "*");
Advertisement
Add Comment
Please, Sign In to add comment