Cody

# Problem 813. Multiply 2 numbers

Solution 1739988

Submitted on 1 Mar 2019 by Maryam Majidi
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')

output = 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')))

output = 0 output = 25 output = 50 output = 75 output = 100 output = 125 output = 150 output = 175 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')))

output = 0 output = 0 output = 0 output = 0 output = 0 output = 0 output = 0 output = 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')))

output = 0 output = -148 output = -296 output = -444 output = -592 output = -740 output = -888 output = -1036 output = -1184 output = -1332 output = -1480 output = -1628 output = -1776 output = -1924 output = -2072 output = -2220 output = -2368 output = -2516 output = -2664 output = -2812 output = -2960 output = -3108 output = -3256 output = -3404 output = -3552 output = -3700 output = -3848 output = -3996 output = -4144 output = -4292 output = -4440 output = -4588 output = -4736 output = -4884 output = -5032 output = -5180 output = -5328 output = -5476 output = -5624 output = -5772 output = -5920 output = -6068 output = -6216 output = -6364 output = -6512 output = -6660 output = -6808 output = -6956 output = -7104 output = -7252 output = -7400 output = -7548 output = -7696 output = -7844 output = -7992 output = -8140 output = -8288 output = -8436 output = -8584 output = -8732 output = -8880 output = -9028 output = -9176 output = -9324 output = -9472 output = -9620 output = -9768 output = -9916 output = -10064 output = -10212 output = -10360 output = -10508 output = -10656 output = -10804 output = -10952 output = -11100 output = -11248 output = -11396 output = -11544 output = -11692 output = -11840 output = -11988 output = -12136 output = -12284 output = -12432 output = -12580 output = -12728 output = -12876 output = -13024 output = -13172 output = -13320 output = -13468 output = -13616 output = -13764 output = -13912 output = -14060 output = -14208 output = -14356 output = -14504 output = -14652 output = -14800 output = -14948 output = -15096 output = -15244 output = -15392 output = -15540 output = -15688 output = -15836 output = -15984 output = -16132 output = -16280 output = -16428 output = -16576 output = -16724 output = -16872 output = -17020 output = -17168 output = -17316 output = -17464 output = -17612 output = -17760 output = -17908 output = -18056 output = -18204 output = -18352 output = -18500 output = -18648 output = -18796 output = -18944 output = -19092 output = -19240 output = -19388 output = -19536 output = -19684 output = -19832 output = -19980 output = -20128 output = -20276 output = -20424 output = -20572 output = -20720 output = -20868 output = -21016 output = -21164 output = -21312 output = -21460 output = -21608 output = -21756 output = -21904 output = -22052 output = -22200 output = -22348 output = -22496 output = -22644 output = -22792 output = -22940 output = -23088 output = -23236 output = -23384 output = -23532 output = -23680 output = -23828 output = -23976 output = -24124 output = -24272 output = -24420 output = -24568 output = -24716 output = -24864 output = -25012 output = -25160 output = -25308 output = -25456 output = -25604 output = -25752 output = -25900 output = -26048 output = -26196 output = -26344 output = -26492 output = -26640 output = -26788 output = -26936 output = -27084 output = -27232 output = -27380 output = -27528 output = -27676 output = -27824 output = -27972 output = -28120 output = -28268 output = -28416 output = -28564 output = -28712 output = -28860 output = -29008 output = -29156 output = -29304 output = -29452 output = -29600 output = -29748 output = -29896 output = -30044 output = -30192 output = -30340 output = -30488 output = -30636 output = -30784 output = -30932 output = -31080 output = -31228 output = -31376 output = -31524 output = -31672 output = -31820 output = -31968 output = -32116 output = -32264 output = -32412 output = -32560 output = -32708 output = -32856 output = -33004 output = -33152 output = -33300 output = -33448 output = -33596 output = -33744 output = -33892 output = -34040 output = -34188 output = -34336 output = -34484 output = -34632 output = -34780 output = -34928 output = -35076 output = -35224 output = -35372 output = -35520 output = -35668 output = -35816 output = -35964 output = -36112 output = -36260 output = -36408 output = -36556 output = -36704 output = -36852 output = -37000 output = -37148 output = -37296 output = -37444 output = -37592 output = -37740 output = -37888 output = -38036 output = -38184 output = -38332 output = -38480 output = -38628 output = -38776 output = -38924 output = -39072 output = -39220 output = -39368 output = -39516 output = -39664 output = -39812 output = -39960 output = -40108 output = -40256 output = -40404 output = -40552 output = -40700 output = -40848 output = -40996 output = -41144 output = -41292 output = -41440 output = -41588 output = -41736 output = -41884 output = -42032 output = -42180 output = -42328 output = -42476 output = -42624 output = -42772 output = -42920 output = -43068 output = -43216 output = -43364 output = -43512 output = -43660 output = -43808 output = -43956 output = -44104 output = -44252 output = -44400 output = -44548 output = -44696 output = -44844 output = -44992 output = -45140 output = -45288 output = -45436 output = -45584 output = -45732 output = -45880 output = -46028 output = -46176 output = -46324 output = -46472 output = -46620 output = -46768 output = -46916 output = -47064 output = -47212 output = -47360 output = -47508 output = -47656 output = -47804 output = -47952 output = -48100 output = -48248 output = -48396 output = -48544 output = -48692 output = -48840 output = -48988 output = -49136 output = -49284 output = -49432 output = -49580 output = -49728 output = -49876 output = -50024 output = -50172 output = -50320 output = -50468 output = -50616 output = -50764 output = -50912 output = -51060 output = -51208 output = -51356 output = -51504 output = -51652 output = -51800 output = -51948 output = -52096 output = -52244 output = -52392 output = -52540 output = -52688 output = -52836 output = -52984 output = -53132 output = -53280 output = -53428 output = -53576 output = -53724 output = -53872 output = -54020 output = -54168 output = -54316 output = -54464 output = -54612 output = -54760 output = -54908 output = -55056 output = -55204 output = -55352 output = -55500 output = -55648 output = -55796 output = -55944 output = -56092 output = -56240 output = -56388 output = -56536 output = -56684 output = -56832 output = -56980 output = -57128 output = -57276 output = -57424 output = -57572 output = -57720 output = -57868 output = -58016 output = -58164 output = -58312 output = -58460 output = -58608 output = -58756 output = -58904 output = -59052 output = -59200 output = -...

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')))

output = 0 output = 286.5000 output = 573 output = 859.5000 output = 1146 output = 1.4325e+03 output = 1719 output = 2.0055e+03 output = 2292 output = 2.5785e+03 output = 2865 output = 3.1515e+03 output = 3438 output = 3.7245e+03 output = 4011 output = 4.2975e+03 output = 4584 output = 4.8705e+03 output = 5157 output = 5.4435e+03 output = 5730 output = 6.0165e+03 output = 6303 output = 6.5895e+03 output = 6876

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')))

output = 0 output = -3.1416 output = -6.2832 output = -9.4248 output = -12.5664 output = -15.7080 output = -18.8496 output = -21.9911 output = -25.1327 output = -28.2743 output = -31.4159 output = -34.5575 output = -37.6991 output = -40.8407 output = -43.9823 output = -47.1239 output = -50.2655 output = -53.4071 output = -56.5487 output = -59.6903 output = -62.8319 output = -65.9734 output = -69.1150 output = -72.2566 output = -75.3982 output = -78.5398 output = -81.6814 output = -84.8230 output = -87.9646 output = -91.1062 output = -94.2478 output = -97.3894 output = -100.5310 output = -103.6726 output = -106.8142 output = -109.9557 output = -113.0973 output = -116.2389 output = -119.3805 output = -122.5221 output = -125.6637 output = -128.8053 output = -131.9469 output = -135.0885 output = -138.2301 output = -141.3717 output = -144.5133 output = -147.6549 output = -150.7964 output = -153.9380 output = -157.0796 output = -160.2212 output = -163.3628 output = -166.5044 output = -169.6460