Advertisement
Spocoman

Wedding Party

Oct 6th, 2023 (edited)
699
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function weddingParty(input) {
  2.     let guests = Number(input[0]);
  3.     let budget = Number(input[1]);
  4.  
  5.     budget -= guests * 20;
  6.  
  7.     if (budget < 0) {
  8.         console.log(`They won\'t have enough money to pay the covert. They will need ${Math.abs(budget)} lv more.`);
  9.    }
  10.    else {
  11.        console.log(`Yes! ${Math.round(0.40 * budget)} lv are for fireworks and ${Math.round(0.60 * budget)} lv are for donation.`);
  12.    }
  13.  
  14.    return;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement