Advertisement
nikolayneykov

Untitled

Oct 27th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const getGets = (arr) => {
  2.   let index = 0;
  3.  
  4.   return () => {
  5.     const toReturn = arr[index];
  6.     index += 1;
  7.     return toReturn;
  8.   };
  9. };
  10. // this is the test
  11. const test = ['-1', '3', '0'];
  12.  
  13. const gets = this.gets || getGets(test);
  14. const print = this.print || console.log;
  15.  
  16. let a = +gets();
  17. let b = +gets();
  18. let c = +gets();
  19.  
  20. const x1 = (-b + Math.sqrt(b ** 2 - 4 * a * c)) / (2 * a);
  21. const x2 = (-b - Math.sqrt(b ** 2 - 4 * a * c)) / (2 * a);
  22.  
  23. console.log(x1);
  24. console.log(x2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement