Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function andProcessors(input) {
- let processors = Number(input[0]);
- let workers = Number(input[1]);
- let days = Number(input[2]);
- let diff = (processors - Math.floor(workers * days * 8 / 3)) * 110.10;
- if (diff > 0) {
- console.log(`Losses: -> ${diff.toFixed(2)} BGN`);
- } else {
- console.log(`Profit: -> ${Math.abs(diff).toFixed(2)} BGN`);
- }
- }
- Тарикатско решение и с тернарен оператор:
- function andProcessors(input) {
- let diff = (Number(input[0]) - Math.floor(Number(input[1]) * Number(input[2]) * 8 / 3)) * 110.10;
- console.log(`${diff > 0 ? 'Losses' : 'Profit'}: -> ${Math.abs(diff).toFixed(2)} BGN`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement