Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function easterGuests(input) {
- let guest = Number(input.shift());
- let budget = Number(input.shift());
- let sum = Math.ceil(guest / 3) * 4 + guest * 2 * 0.45;
- if (budget >= sum) {
- console.log(`Lyubo bought ${Math.ceil(guest / 3)} Easter bread and ${guest * 2} eggs.`);
- console.log(`He has ${(budget - sum).toFixed(2)} lv. left.`);
- } else {
- console.log("Lyubo doesn't have enough money.");
- console.log(`He needs ${(sum - budget).toFixed(2)} lv. more.`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement