Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve (nums) {
  2.     let firstNum = Number(nums[0]);
  3.     let secondNum = Number(nums[1]);
  4.     let thirdNum = Number(nums[2]);
  5.  
  6.     if(firstNum + secondNum === thirdNum){
  7.         console.log(`${Math.min(firstNum, secondNum)} + ${Math.max(firstNum, secondNum)} = ${thirdNum}`);
  8.     }
  9.     else if(firstNum + thirdNum === secondNum){
  10.         console.log(`${Math.min(firstNum, thirdNum)} + ${Math.max(firstNum, thirdNum)} = ${secondNum}`);
  11.     }
  12.     else if(secondNum + thirdNum === firstNum){
  13.         console.log(`${Math.min(secondNum, thirdNum)} + ${Math.max(secondNum, thirdNum)} = ${firstNum}`);
  14.     }
  15.     else {
  16.         console.log('No');
  17.     }  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement