Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let input = [
- '1',
- '8',
- '5'
- ];
- let print = this.print || console.log;
- let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
- let firstNum = Number(gets());
- let secondNum = Number(gets());
- let thirdNum = Number(gets());
- let totalSum = 0;
- if (firstNum <= 1 && secondNum > 1 && thirdNum > 1) {
- totalSum = firstNum + secondNum * thirdNum;
- } else if (firstNum > 1 && secondNum <= 1 && thirdNum > 1) {
- totalSum = firstNum + secondNum * thirdNum;
- } else if (firstNum > 1 && secondNum > 1 && thirdNum <= 1) {
- totalSum = firstNum * secondNum + thirdNum;
- } else if (firstNum > 1 && secondNum > 1 && thirdNum > 1) {
- totalSum = firstNum * secondNum * thirdNum;
- }else{
- totalSum = firstNum + secondNum + thirdNum;
- }
- print(totalSum);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement