Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://shpp.gitbook.io/zero/tutorials/arrays/atm
- let card = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- let numbercard = 0, next;
- do {
- let sum = 0, money;
- do {
- numbercard = +prompt("Введіть номер карти");
- } while (isNaN(numbercard) || numbercard < 0 || numbercard > 9);
- console.log("\nВведіть номер карти " + numbercard);
- do {
- money = +prompt('Скільки покласти?');
- } while (isNaN(money) || money < -1000 || money > 1000);
- console.log("Скільки покласти? " + money);
- card[numbercard] += money;
- for (let i = 0; i < card.length; i++) {
- console.put(card[i] + " ");
- sum += card[i];
- }
- console.log("\nВ сумі на всіх картках " + sum);
- next = prompt("Продовжити? Натисни +")
- } while (next == "+");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement