Cody

Problem 2157. Multiplication

Solution 3305668

Submitted on 21 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   Pass
x=[1 2]; y=1; y_correct=[1 2]; assert(isequal(muldif(x,y),y_correct));

ar = '1' result = 1 2

2   Pass
x=1; y=1; y_correct=1; assert(isequal(muldif(x,y),y_correct));

ar = '1' result = 1

3   Fail
x=[1 2 0 1]; y=[8 5 1]; y_correct = [8 21 11 10 5 1]; assert(isequal(muldif(x,y),y_correct))

ar = 3×1 char array '8' '5' '1' result = 800 1600 0 800

Assertion failed.

4   Fail
x=[1 2 3 4 4 1 2 1 1 1]; y=[1 2 3 4 5 6 9 10]; y_correct=[1 4 10 20 34 49 68 90 104 109 101 73 43 40 25 19 10]; assert(isequal(muldif(x,y),y_correct));

ar = 8×2 char array '01' '02' '03' '04' '05' '06' '09' '10' result = 10000000 20000000 30000000 40000000 40000000 10000000 20000000 10000000 10000000 10000000

Assertion failed.

5   Fail
x=[1:10 0 1]; y=[8 5:1:25 1]; y_correct = [8 21 40 66 100 143 196 260 336 425 440 503 555 611 667 723 779 835 891 947 1003 1059 1090 1094 1070 1017 934 820 674 495 282 34 25 1 ]; assert(isequal(muldif(x,y),y_correct))

ar = 23×2 char array '08' '05' '06' '07' '08' '09' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '01' result = 1.0e+23 * 0.8000 1.6000 2.4000 3.2000 4.0000 4.8000 5.6000 6.4000 7.2000 8.0000 0 0.8000

Assertion failed.

Suggested Problems

More from this Author21

Community Treasure Hunt

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

Start Hunting!