Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function OwnBussines(input){
- let w = Number(input.shift());
- let l = Number(input.shift());
- let h = Number(input.shift());
- let Space = w * l * h;
- let command = Number(input.shift());
- while(command !== 'Done'){
- let computers = Number(command)
- Space -= computers;
- if(Space <= 0){
- break;
- }
- command = input.shift();
- }
- if(command === 'Done'){
- console.log(`${Space} Cubic meters left.`);
- }else{
- console.log(`No more free space! You need ${Math.abs(Space)} Cubic meters more.`);
- }
- }
- OwnBussines([
- 10,
- 1,
- 2,
- 4,
- 6,
- 'Done'
- ]);
Advertisement
Add Comment
Please, Sign In to add comment