Advertisement
Guest User

Untitled

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