Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function profit(input) {
- let oneBGN = Number(input[0]);
- let twoBGN = Number(input[1]);
- let fiveBGN = Number(input[2]);
- let sum = Number(input[3]);
- for (let i = 0; i <= oneBGN; i++) {
- for (let j = 0; j <= twoBGN; j++) {
- for (let k = 0; k <= fiveBGN; k++) {
- if (i * 1 + j * 2 + k * 5 === sum) {
- console.log(`${i} * 1 lv. + ${j} * 2 lv. + ${k} * 5 lv. = ${sum} lv.`);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement