Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function smartLili([arg1, arg2, arg3]) {
- let age = Number(arg1);
- let priceWashmashine = Number(arg2);
- let priceToy = Number(arg3);
- let money = 0;
- for (let i = 1; i <= age; i++) {
- if (i % 2 === 0) {
- money += (i * 10) / 2 - 1;
- } else {
- money += priceToy;
- }
- }
- if (money >= priceWashmashine) {
- console.log(`Yes! ${(money - priceWashmashine).toFixed(2)}`);
- } else {
- console.log(`No! ${(priceWashmashine - money).toFixed(2)}`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement