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