SHARE
TWEET

Trubi v Basein

Ivankooo1 May 26th, 2019 (edited) 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  function Basein(input){
  2.          let obemvLitri = Number(input.shift());
  3.          let debit1truba = Number(input.shift());
  4.          let debit2truba = Number(input.shift());
  5.          let otsustvashtiChasove = Number(input.shift());
  6.          
  7.          let watertraba1 = debit1truba * otsustvashtiChasove;
  8.          let watertraba2 = debit2truba * otsustvashtiChasove;
  9.          let water = watertraba1 + watertraba2;
  10.  
  11.          if(water <= obemvLitri){
  12.            console.log(`The pool is ${Math.trunc(water / obemvLitri *100).toFixed(2)}% full.
  13.                       Pipe 1 : ${Math.trunc(watertraba1 / water *100).toFixed(2)}%.
  14.                       Pipe 2 : ${Math.trunc(watertraba2 / water *100).toFixed(2)}%
  15.                       `);
  16.          }else{
  17.             console.log(
  18.                        `For ${otsustvashtiChasove.toFixed(2)} hours the pool overflows
  19.                        with ${(water - obemvLitri).toFixed(2)} liters.`
  20.                 );
  21.         }
  22.     }
  23.     Basein(['1000','100','120','3']);
  24.     Basein(['100','100','100','2.5']);
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