Cody

# Problem 813. Multiply 2 numbers

Solution 1997133

Submitted on 31 Oct 2019 by Asif Newaz
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; y =2; y_correct = 2; assert(isequal(round(your_fcn_name(x,y)),y_correct)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, '*')),'sign * forbidden') assert(isempty(strfind(filetext, 'mtimes')),'mtimes forbidden') assert(isempty(strfind(filetext, 'cross')),'cross forbidden') assert(isempty(strfind(filetext, 'prod')),'prod forbidden') assert(isempty(strfind(filetext, 'cumprod'))) assert(isempty(strfind(filetext, 'times'))) assert(isempty(strfind(filetext, 'mldivide'))) assert(isempty(strfind(filetext, 'mrdivide'))) assert(isempty(strfind(filetext, '/')),'/ forbidden') assert(isempty(strfind(filetext, '\'))) assert(isempty(strfind(filetext, '-'))) assert(isempty(strfind(filetext, '^')),'^ forbidden') assert(isempty(strfind(filetext, 'dot'))) assert(isempty(strfind(filetext, '''')),'string forbidden')

b = 0 a = 1 1 a1 = 0 output1 = 2 output2 = 0 output = 2

2   Pass
x = 8; y =25; y_correct = 200; assert(isequal(round(your_fcn_name(x,y)),y_correct)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, '*'))) assert(isempty(strfind(filetext, 'mtimes'))) assert(isempty(strfind(filetext, 'cross'))) assert(isempty(strfind(filetext, 'prod'))) assert(isempty(strfind(filetext, 'cumprod'))) assert(isempty(strfind(filetext, 'times'))) assert(isempty(strfind(filetext, 'dot')))

b = 0 a = 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 a1 = 0 0 0 0 0 0 0 0 output1 = 200 output2 = 0 output = 200

3   Pass
x = 8; y =0; y_correct = 0; assert(isequal(round(your_fcn_name(x,y)),y_correct)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, '*'))) assert(isempty(strfind(filetext, 'mtimes'))) assert(isempty(strfind(filetext, 'cross'))) assert(isempty(strfind(filetext, 'prod'))) assert(isempty(strfind(filetext, 'cumprod'))) assert(isempty(strfind(filetext, 'times'))) assert(isempty(strfind(filetext, 'dot')))

b = 0 a = 1×0 empty double row vector a1 = 0 0 0 0 0 0 0 0 output1 = 0 output2 = 0 output = 0

4   Pass
x = -148; y =2865; y_correct = -424020; assert(isequal(round(your_fcn_name(x,y)),y_correct)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, '*'))) assert(isempty(strfind(filetext, 'mtimes'))) assert(isempty(strfind(filetext, 'cross'))) assert(isempty(strfind(filetext, 'prod'))) assert(isempty(strfind(filetext, 'cumprod'))) assert(isempty(strfind(filetext, 'times'))) assert(isempty(strfind(filetext, 'dot')))

b = 0 a = Columns 1 through 30 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 31 through 60 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 61 through 90 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 91 through 120 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 121 through 150 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 151 through 180 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 181 through 210 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 211 through 240 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 241 through 270 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 271 through 300 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 301 through 330 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 331 through 360 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 361 through 390 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 391 through 420 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 421 through 450 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 451 through 480 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 481 through 510 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 511 through 540 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 541 through 570 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 571 through 600 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 601 through 630 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 631 through 660 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 661 through 690 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 691 through 720 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 721 through 750 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 751 through 780 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 781 through 810 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 811 through 840 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 841 through 870 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 871 through 900 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 901 through 930 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 931 through 960 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 961 through 990 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 991 through 1020 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 1021 through 1050 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 1051 through 1080 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 1081 through 1110 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 1111 through 1140 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 1141 through 1170 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 1171 through 1200 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 1201 through 1230 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 1231 through 1260 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 1261 through 1290 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 1291 through 1320 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 1321 through 1350 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 1351 through 1380 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 1381 through 1410 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 Columns 1411 through 1440 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 -148 ...

5   Pass
x = randi([1 58]); y =286.5; y_correct = x*y; assert(abs( your_fcn_name(x,y)-y_correct)<1e-9) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, '*'))) assert(isempty(strfind(filetext, 'mtimes'))) assert(isempty(strfind(filetext, 'cross'))) assert(isempty(strfind(filetext, 'prod'))) assert(isempty(strfind(filetext, 'cumprod'))) assert(isempty(strfind(filetext, 'times'))) assert(isempty(strfind(filetext, 'dot')))

b = 0.5000 [Warning: Integer operands are required for colon operator when used as index.] [> In your_fcn_name (line 3) In ScoringEngineTestPoint5 (line 4) In solutionTest (line 11)] a = Columns 1 through 30 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 Columns 31 through 60 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 Columns 61 through 90 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 Columns 91 through 120 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 Columns 121 through 150 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 Columns 151 through 180 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 Columns 181 through 210 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 Columns 211 through 240 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 Columns 241 through 270 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 Columns 271 through 286 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 a1 = Columns 1 through 18 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 Columns 19 through 26 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 output1 = 7436 output2 = 13 output = 7449

6   Pass
x = randi([14 580]); y = -pi; y_correct = x*y; assert(abs( your_fcn_name(x,y)-y_correct)<1e-9) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, '*'))) assert(isempty(strfind(filetext, 'mtimes'))) assert(isempty(strfind(filetext, 'cross'))) assert(isempty(strfind(filetext, 'prod'))) assert(isempty(strfind(filetext, 'cumprod'))) assert(isempty(strfind(filetext, 'times'))) assert(isempty(strfind(filetext, 'dot'))) assert(isempty(strfind(filetext, 'num2str'))) assert(isempty(strfind(filetext, 'int2str'))) assert(isempty(strfind(filetext, 'dec2bin')))

b = 0.1416 [Warning: Integer operands are required for colon operator when used as index.] [> In your_fcn_name (line 3) In ScoringEngineTestPoint6 (line 4) In solutionTest (line 13)] a = 273 273 273 a1 = Columns 1 through 18 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 19 through 36 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 37 through 54 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 55 through 72 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 73 through 90 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 91 through 108 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 109 through 126 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 127 through 144 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 145 through 162 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 163 through 180 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 181 through 198 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 199 through 216 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 217 through 234 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 235 through 252 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 253 through 270 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 0.1416 Columns 271 through 273 0.1416 0.1416 0.1416 output1 = 819 output2 = 38.6548 output = 857.6548 output = -857.6548