Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function flowerShop(input) {
- let magnolia = parseInt(input[0]);
- let hyacinth = parseInt(input[1]);
- let rose = parseInt(input[2])
- let cactus = parseInt(input[3]);
- let gift = parseFloat(input[4]);
- let total = (magnolia * 3.25 + hyacinth * 4 + rose * 3.5 + cactus * 8) * 0.95;
- if (total >= gift){
- console.log(`She is left with ${Math.floor(total - gift)} leva.`);
- } else {
- console.log(`She will have to borrow ${Math.ceil(gift - total)} leva.`);
- }
- }
- Taрикатско решение:)
- function flowerShop(input) {
- let total = (parseInt(input[0]) * 3.25 + parseInt(input[1]) * 4 + parseInt(input[2]) * 3.5 + parseInt(input[3]) * 8) * 0.95;
- if (total >= parseFloat(input[4])){
- console.log(`She is left with ${Math.floor(total - parseFloat(input[4]))} leva.`);
- } else {
- console.log(`She will have to borrow ${Math.ceil(parseFloat(input[4]) - total)} leva.`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement