Cody

Problem 44786. Lunar Arithmetic (Multiplication)

Solution 3292173

Submitted on 20 Oct 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   Fail
x = 15866; y = 147; assert(isequal(lunarMultiplication(x,y),1145766))

Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in lunarMultiplication (line 8) matOut(i,(i-1):end)=min(yVec,xVec(i)); Error in Test1 (line 3) assert(isequal(lunarMultiplication(x,y),1145766))

2   Fail
x = 169; y = 248; assert(isequal(lunarMultiplication(x,y),12468))

Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in lunarMultiplication (line 8) matOut(i,(i-1):end)=min(yVec,xVec(i)); Error in Test2 (line 3) assert(isequal(lunarMultiplication(x,y),12468))

3   Fail
x = 7; y = 4; assert(isequal(lunarMultiplication(x,y),4))

Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in lunarMultiplication (line 8) matOut(i,(i-1):end)=min(yVec,xVec(i)); Error in Test3 (line 3) assert(isequal(lunarMultiplication(x,y),4))

4   Fail
x = 78; y = 4; assert(isequal(lunarMultiplication(x,y),44))

Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in lunarMultiplication (line 8) matOut(i,(i-1):end)=min(yVec,xVec(i)); Error in Test4 (line 3) assert(isequal(lunarMultiplication(x,y),44))

5   Fail
x = 7799123; y = 109; assert(isequal(lunarMultiplication(x,y),117799123))

Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in lunarMultiplication (line 8) matOut(i,(i-1):end)=min(yVec,xVec(i)); Error in Test5 (line 3) assert(isequal(lunarMultiplication(x,y),117799123))

Suggested Problems

More from this Author72

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!