Cody

# Problem 44785. Lunar Arithmetic (Addition)

Solution 2615770

Submitted on 26 Jun 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = 5; y = 6; assert(isequal(lunarAddition(x,y),6))

lunarResult = 6

2   Fail
x = 456; y = 789; assert(isequal(lunarAddition(x,y),789))

Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'. Error in lunarAddition (line 6) lunarResult = (10^((n-1):-1:0))*dig' Error in Test2 (line 3) assert(isequal(lunarAddition(x,y),789))

3   Fail
x = 86; y = 12374; assert(isequal(lunarAddition(x,y),12386))

Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'. Error in lunarAddition (line 6) lunarResult = (10^((n-1):-1:0))*dig' Error in Test3 (line 3) assert(isequal(lunarAddition(x,y),12386))

4   Fail
x = 29; y = 1652; z = 95412; assert(isequal(lunarAddition(x,y,z),95659))

Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'. Error in lunarAddition (line 6) lunarResult = (10^((n-1):-1:0))*dig' Error in Test4 (line 4) assert(isequal(lunarAddition(x,y,z),95659))

5   Fail
x = 33; y = 1111; z = 4456; a = 38; assert(isequal(lunarAddition(x,y,z,a),4458))

Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'. Error in lunarAddition (line 6) lunarResult = (10^((n-1):-1:0))*dig' Error in Test5 (line 5) assert(isequal(lunarAddition(x,y,z,a),4458))

6   Fail
x = 85214; y = 4785; z = 1; a = 850615; b = 14702140; assert(isequal(lunarAddition(x,y,z,a,b),14885785))

Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'. Error in lunarAddition (line 6) lunarResult = (10^((n-1):-1:0))*dig' Error in Test6 (line 6) assert(isequal(lunarAddition(x,y,z,a,b),14885785))

7   Pass
x = 9; y = 0; assert(isequal(lunarAddition(x,y),9))

lunarResult = 9