Cody

Problem 44785. Lunar Arithmetic (Addition)

Solution 2928739

Submitted on 9 Sep 2020 by Alex
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))

ans = 10×2 char array '00' '00' '00' '00' '00' '00' '00' '00' '00' '56' ans = 6

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

ans = 10×2 char array '00' '00' '00' '00' '00' '00' '00' '47' '58' '69' ans = 789

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

ans = 10×2 char array '00' '00' '00' '00' '00' '01' '02' '03' '87' '64' ans = 12386

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

ans = 10×3 char array '000' '000' '000' '000' '000' '009' '015' '064' '251' '922' ans = 95659

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

ans = 10×4 char array '0000' '0000' '0000' '0000' '0000' '0000' '0140' '0140' '3153' '3168' ans = 4458

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

ans = 10×5 char array '00000' '00000' '00001' '00004' '00087' '80050' '54002' '27061' '18014' '45150' ans = 14885785

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

ans = 10×2 char array '00' '00' '00' '00' '00' '00' '00' '00' '00' '90' ans = 9

Suggested Problems

More from this Author62

Community Treasure Hunt

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

Start Hunting!