Advertisement
Spocoman

Charity Campaign

Jan 4th, 2022
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function charityCampaign(input) {
  2.     let days = parseInt(input[0]);
  3.     let cookers = parseInt(input[1]);
  4.     let cakes = parseInt(input[2]);
  5.     let waffle = parseInt(input[3]);
  6.     let pancakes = parseInt(input[4]);
  7.     let sum = days * (cookers * ((cakes * 45) + (waffle * 5.80) + (pancakes * 3.20)));
  8.     console.log(sum - sum / 8);
  9. }
  10.  
  11.  
  12.  
  13. Друго решение:
  14.  
  15. function charityCampaign(days, cookers, cakes, waffle, pancakes) {
  16.     let sum = Number(days * (cookers * ((cakes * 45) + (waffle * 5.80) + (pancakes * 3.20))));
  17.     console.log(`${(sum-sum/8).toFixed(2)}`);
  18. }
  19.  
  20.  
  21. Тарикатско решение:)
  22.  
  23.  
  24. function charityCampaignBadPractice(input) {
  25.     let sum = Number(input[0]) * (Number(input[1]) * ((Number(input[2]) * 45) + (Number(input[3]) * 5.80) + (Number(input[4]) * 3.20)));
  26.     console.log(sum - sum / 8);
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement