Ledger Nano X - The secure hardware wallet
SHARE
TWEET

05.OwnB- final_exam_29.02.2020

vborislavova Mar 28th, 2020 (edited) 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function ownB(input) {
  2.             let widthFreePlace = Number(input.shift());
  3.             let lenghtFreePlace =Number(input.shift());
  4.             let heightFreePlace =Number(input.shift());
  5.  
  6.             let command = "";
  7.             let areaFreePlace = 0;
  8.             let areaBox = 0;
  9.  
  10.             while((command = input.shift()) != "Done")
  11.             {
  12.                 areaFreePlace = widthFreePlace * lenghtFreePlace * heightFreePlace;
  13.                 let numberBox = Number(command);
  14.                 areaBox += numberBox;
  15.  
  16.                 if(areaFreePlace < areaBox && command != "Done")
  17.                 {
  18.                     break;
  19.                 }
  20.             }
  21.             if(areaFreePlace > 0 && command == "Done")
  22.             {
  23.                 console.log(`${areaFreePlace - areaBox} Cubic meters left.`);
  24.             }
  25.             else
  26.             {
  27.                 console.log(`No more free space! You need ${Math.abs(areaFreePlace - areaBox)} Cubic meters more.`);
  28.             }
  29.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top