Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Задача. Вивести ялинку на екран
- // https://zero.p2p.shpp.me/tasks/3_5_christmas_tree.html
- let treeSize = +prompt("Вкажіть розмір ялинки");
- let i = 0;
- while (i <= treeSize) {
- for (let n = treeSize; n > i; n--) {
- console.put(" ");
- }
- for (let j = 0; j < i; j++) {
- console.put("*");
- }
- for (let k = 1; k < i; k++) {
- console.put("*");
- }
- i++;
- console.log();
- }
- let spaces = 0;
- while (spaces < treeSize - 1) {
- console.put(" ");
- spaces++;
- }
- console.log("*");
Advertisement
Add Comment
Please, Sign In to add comment