Advertisement
Spocoman

Savings

Oct 7th, 2023
882
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function savings(input) {
  2.     let salary = Number(input[0]);
  3.     let months = Number(input[1]);
  4.     let minimalCosts = Number(input[2]);
  5.  
  6.     let monthlySavings = salary * 0.70 - minimalCosts;
  7.  
  8.     console.log(`She can save ${(monthlySavings / salary * 100).toFixed(2)}%\n${(monthlySavings * months).toFixed(2)}`);
  9.  
  10.     return;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement