Advertisement
Liliana797979

vqrno reshenie na clever Lily

Dec 18th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.      
  2. function smartLili([arg1, arg2, arg3]) {
  3.     let age = Number(arg1);
  4.     let priceWashmashine = Number(arg2);
  5.     let priceToy = Number(arg3);
  6.     let money = 0;
  7.  
  8.  
  9.     for (let i = 1; i <= age; i++) {
  10.         if (i % 2 === 0) {
  11.             money += (i * 10) / 2 - 1;
  12.         } else {
  13.             money += priceToy;
  14.         }
  15.     }
  16.  
  17.     if (money >= priceWashmashine) {
  18.         console.log(`Yes! ${(money - priceWashmashine).toFixed(2)}`);
  19.     } else {
  20.         console.log(`No! ${(priceWashmashine - money).toFixed(2)}`);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement