Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function charityCampaign(input) {
- let days = parseInt(input[0]);
- let cookers = parseInt(input[1]);
- let cakes = parseInt(input[2]);
- let waffle = parseInt(input[3]);
- let pancakes = parseInt(input[4]);
- let sum = days * (cookers * ((cakes * 45) + (waffle * 5.80) + (pancakes * 3.20)));
- console.log(sum - sum / 8);
- }
- Друго решение:
- function charityCampaign(days, cookers, cakes, waffle, pancakes) {
- let sum = Number(days * (cookers * ((cakes * 45) + (waffle * 5.80) + (pancakes * 3.20))));
- console.log(`${(sum-sum/8).toFixed(2)}`);
- }
- Тарикатско решение:)
- function charityCampaignBadPractice(input) {
- let sum = Number(input[0]) * (Number(input[1]) * ((Number(input[2]) * 45) + (Number(input[3]) * 5.80) + (Number(input[4]) * 3.20)));
- console.log(sum - sum / 8);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement