SHARE
TWEET

Untitled

a guest Feb 29th, 2020 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2.  
  3.     let key = Number(input.shift());
  4.     let opertaion = input.shift();
  5.  
  6.     let result=0;
  7.     let output = ""
  8.  
  9.     for (let a = 1; a <= key; a++) {
  10.         for (let b = 1; b <= key; b++) {
  11.             for (let c = 1; c <= key; c++) {
  12.                 switch (opertaion) {
  13.                     case "+":
  14.                         a < b < c === key;
  15.                         result = a + b + c;
  16.                         output =`${a} + ${b} + ${c} = ${key}`;
  17.                         break;
  18.                     case "*":
  19.                         a > b > c === key;
  20.                         result = a * b * c;
  21.                         output =`${a} * ${b} * ${c} = ${key}`;
  22.                         break;
  23.                 }
  24.  
  25.             }
  26.  
  27.         }
  28.  
  29.  
  30.        
  31.     }
  32.  
  33.  
  34.  
  35.  
  36. }
  37. solve([12])
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