Cody

# Problem 813. Multiply 2 numbers

Solution 216891

Submitted on 13 Mar 2013 by Michael
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')

``` z = 2 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')))

``` z = 25 z = 50 z = 75 z = 100 z = 125 z = 150 z = 175 z = 200 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')))

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

``` z = -148 z = -296 z = -444 z = -592 z = -740 z = -888 z = -1036 z = -1184 z = -1332 z = -1480 z = -1628 z = -1776 z = -1924 z = -2072 z = -2220 z = -2368 z = -2516 z = -2664 z = -2812 z = -2960 z = -3108 z = -3256 z = -3404 z = -3552 z = -3700 z = -3848 z = -3996 z = -4144 z = -4292 z = -4440 z = -4588 z = -4736 z = -4884 z = -5032 z = -5180 z = -5328 z = -5476 z = -5624 z = -5772 z = -5920 z = -6068 z = -6216 z = -6364 z = -6512 z = -6660 z = -6808 z = -6956 z = -7104 z = -7252 z = -7400 z = -7548 z = -7696 z = -7844 z = -7992 z = -8140 z = -8288 z = -8436 z = -8584 z = -8732 z = -8880 z = -9028 z = -9176 z = -9324 z = -9472 z = -9620 z = -9768 z = -9916 z = -10064 z = -10212 z = -10360 z = -10508 z = -10656 z = -10804 z = -10952 z = -11100 z = -11248 z = -11396 z = -11544 z = -11692 z = -11840 z = -11988 z = -12136 z = -12284 z = -12432 z = -12580 z = -12728 z = -12876 z = -13024 z = -13172 z = -13320 z = -13468 z = -13616 z = -13764 z = -13912 z = -14060 z = -14208 z = -14356 z = -14504 z = -14652 z = -14800 z = -14948 z = -15096 z = -15244 z = -15392 z = -15540 z = -15688 z = -15836 z = -15984 z = -16132 z = -16280 z = -16428 z = -16576 z = -16724 z = -16872 z = -17020 z = -17168 z = -17316 z = -17464 z = -17612 z = -17760 z = -17908 z = -18056 z = -18204 z = -18352 z = -18500 z = -18648 z = -18796 z = -18944 z = -19092 z = -19240 z = -19388 z = -19536 z = -19684 z = -19832 z = -19980 z = -20128 z = -20276 z = -20424 z = -20572 z = -20720 z = -20868 z = -21016 z = -21164 z = -21312 z = -21460 z = -21608 z = -21756 z = -21904 z = -22052 z = -22200 z = -22348 z = -22496 z = -22644 z = -22792 z = -22940 z = -23088 z = -23236 z = -23384 z = -23532 z = -23680 z = -23828 z = -23976 z = -24124 z = -24272 z = -24420 z = -24568 z = -24716 z = -24864 z = -25012 z = -25160 z = -25308 z = -25456 z = -25604 z = -25752 z = -25900 z = -26048 z = -26196 z = -26344 z = -26492 z = -26640 z = -26788 z = -26936 z = -27084 z = -27232 z = -27380 z = -27528 z = -27676 z = -27824 z = -27972 z = -28120 z = -28268 z = -28416 z = -28564 z = -28712 z = -28860 z = -29008 z = -29156 z = -29304 z = -29452 z = -29600 z = -29748 z = -29896 z = -30044 z = -30192 z = -30340 z = -30488 z = -30636 z = -30784 z = -30932 z = -31080 z = -31228 z = -31376 z = -31524 z = -31672 z = -31820 z = -31968 z = -32116 z = -32264 z = -32412 z = -32560 z = -32708 z = -32856 z = -33004 z = -33152 z = -33300 z = -33448 z = -33596 z = -33744 z = -33892 z = -34040 z = -34188 z = -34336 z = -34484 z = -34632 z = -34780 z = -34928 z = -35076 z = -35224 z = -35372 z = -35520 z = -35668 z = -35816 z = -35964 z = -36112 z = -36260 z = -36408 z = -36556 z = -36704 z = -36852 z = -37000 z = -37148 z = -37296 z = -37444 z = -37592 z = -37740 z = -37888 z = -38036 z = -38184 z = -38332 z = -38480 z = -38628 z = -38776 z = -38924 z = -39072 z = -39220 z = -39368 z = -39516 z = -39664 z = -39812 z = -39960 z = -40108 z = -40256 z = -40404 z = -40552 z = -40700 z = -40848 z = -40996 z = -41144 z = -41292 z = -41440 z = -41588 z = -41736 z = -41884 z = -42032 z = -42180 z = -42328 z = -42476 z = -42624 z = -42772 z = -42920 z = -43068 z = -43216 z = -43364 z = -43512 z = -43660 z = -43808 z = -43956 z = -44104 z = -44252 z = -44400 z = -44548 z = -44696 z = -44844 z = -44992 z = -45140 z = -45288 z = -45436 z = -45584 z = -45732 z = -45880 z = -46028 z = -46176 z = -46324 z = -46472 z = -46620 z = -46768 z = -46916 z = -47064 z = -47212 z = -47360 z = -47508 z = -47656 z = -47804 z = -47952 z = -48100 z = -48248 z = -48396 z = -48544 z = -48692 z = -48840 z = -48988 z = -49136 z = -49284 z = -49432 z = -49580 z = -49728 z = -49876 z = -50024 z = -50172 z = -50320 z = -50468 z = -50616 z = -50764 z = -50912 z = -51060 z = -51208 z = -51356 z = -51504 z = -51652 z = -51800 z = -51948 z = -52096 z = -52244 z = -52392 z = -52540 z = -52688 z = -52836 z = -52984 z = -53132 z = -53280 z = -53428 z = -53576 z = -53724 z = -53872 z = -54020 z = -54168 z = -54316 z = -54464 z = -54612 z = -54760 z = -54908 z = -55056 z = -55204 z = -55352 z = -55500 z = -55648 z = -55796 z = -55944 z = -56092 z = -56240 z = -56388 z = -56536 z = -56684 z = -56832 z = -56980 z = -57128 z = -57276 z = -57424 z = -57572 z = -57720 z = -57868 z = -58016 z = -58164 z = -58312 z = -58460 z = -58608 z = -58756 z = -58904 z = -59052 z = -59200 z = -59348 z = -59496 z = -59644 z = -59792 z = -59940 z = -60088 z = -60236 z = -60384 z = -60532 z = -60680 z = -60828 z = -60976 z = -61124 z = -61272 z = -61420 z = -61568 z = -61716 z = -61864 z = -62012 z = -62160 z = -62308 z = -62456 z = -62604 z = -62752 z = -62900 z = -63048 z = -63196 z = -63344 z = -63492 z = -63640 z = -63788 z = -63936 z = -64084 z = -64232 z = -64380 z = -64528 z = -64676 z = -64824 z = -64972 z = -65120 z = -65268 z = -65416 z = -65564 z = -65712 z = -65860 z = -66008 z = -66156 z = -66304 z = -66452 z = -66600 z = -66748 z = -66896 z = -67044 z = -67192 z = -67340 z = -67488 z = -67636 z = -67784 z = -67932 z = -68080 z = -68228 z = -68376 z = -68524 z = -68672 z = -68820 z = -68968 z = -69116 z = -69264 z = -69412 z = -69560 z = -69708 z = -69856 z = -70004 z = -70152 z = -70300 z = -70448 z = -70596 z = -70744 z = -70892 z = -71040 z = -71188 z = -71336 z = -71484 z = -71632 z = -71780 z = -71928 z = -72076 z = -72224 z = -72372 z = -72520 z = -72668 z = -72816 z = -72964 z = -73112 z = -73260 z = -73408 z = -73556 z = -73704 z = -73852 z = -74000 z = -74148 z = -74296 z = -74444 z = -74592 z = -74740 z = -74888 z = -75036 z = -75184 z = -75332 z = -75480 z = -75628 z = -75776 z = -75924 z = -76072 z = -76220 z = -76368 z = -76516 z = -76664 z = -76812 z = -76960 z = -77108 z = -77256 z = -77404 z = -77552 z = -77700 z = -77848 z = -77996 z = -78144 z = -78292 z = -78440 z = -78588 z = -78736 z = -78884 z = -79032 z = -79180 z = -79328 z = -79476 z = -79624 z = -79772 z = -79920 z = -80068 z = -80216 z = -80364 z = -80512 z = -80660 z = -80808 z = -80956 z = -81104 z = -81252 z = -81400 z = -81548 z = -81696 z = -81844 z = -81992 z = -82140 z = -82288 z = -82436 z = -82584 z = -82732 z = -82880 z = -83028 z = -83176 z = -83324 z = -83472 z = -83620 z = -83768 z = -83916 z = -84064 z = -84212 z = -84360 z = -84508 z = -84656 z = -84804 z = -84952 z = -85100 z = -85248 z = -85396 z = -85544 z = -85692 z = -85840 z = -85988 z = -86136 z = -86284 z = -86432 z = -86580 z = -86728 z = -86876 z = -87024 z = -87172 z = -87320 z = ...```

5   Pass
%% Test 5 : randi!! 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')))

``` z = 286.5000 z = 573 z = 859.5000 z = 1146 z = 1.4325e+03 z = 1719 z = 2.0055e+03 z = 2292 z = 2.5785e+03 z = 2865 z = 3.1515e+03 z = 3438 output = 3438 ```

6   Pass
%% Test 6 : randi and pi !! 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')))

``` z = -3.1416 z = -6.2832 z = -9.4248 z = -12.5664 z = -15.7080 z = -18.8496 z = -21.9911 z = -25.1327 z = -28.2743 z = -31.4159 z = -34.5575 z = -37.6991 z = -40.8407 z = -43.9823 z = -47.1239 z = -50.2655 z = -53.4071 z = -56.5487 z = -59.6903 z = -62.8319 z = -65.9734 z = -69.1150 z = -72.2566 z = -75.3982 z = -78.5398 z = -81.6814 z = -84.8230 z = -87.9646 z = -91.1062 z = -94.2478 z = -97.3894 z = -100.5310 z = -103.6726 z = -106.8142 z = -109.9557 z = -113.0973 z = -116.2389 z = -119.3805 z = -122.5221 z = -125.6637 z = -128.8053 z = -131.9469 z = -135.0885 z = -138.2301 z = -141.3717 z = -144.5133 z = -147.6549 z = -150.7964 z = -153.9380 z = -157.0796 z = -160.2212 z = -163.3628 z = -166.5044 z = -169.6460 z = -172.7876 z = -175.9292 z = -179.0708 z = -182.2124 z = -185.3540 z = -188.4956 z = -191.6372 z = -194.7787 z = -197.9203 z = -201.0619 z = -204.2035 z = -207.3451 z = -210.4867 z = -213.6283 z = -216.7699 z = -219.9115 z = -223.0531 z = -226.1947 z = -229.3363 z = -232.4779 z = -235.6194 z = -238.7610 z = -241.9026 z = -245.0442 z = -248.1858 z = -251.3274 z = -254.4690 z = -257.6106 z = -260.7522 z = -263.8938 z = -267.0354 z = -270.1770 z = -273.3186 z = -276.4602 z = -279.6017 z = -282.7433 z = -285.8849 z = -289.0265 z = -292.1681 z = -295.3097 z = -298.4513 z = -301.5929 z = -304.7345 z = -307.8761 z = -311.0177 z = -314.1593 z = -317.3009 z = -320.4425 z = -323.5840 z = -326.7256 z = -329.8672 z = -333.0088 z = -336.1504 z = -339.2920 z = -342.4336 z = -345.5752 z = -348.7168 z = -351.8584 z = -355.0000 z = -358.1416 z = -361.2832 z = -364.4247 z = -367.5663 z = -370.7079 z = -373.8495 z = -376.9911 z = -380.1327 z = -383.2743 z = -386.4159 z = -389.5575 z = -392.6991 z = -395.8407 z = -398.9823 z = -402.1239 z = -405.2655 z = -408.4070 z = -411.5486 z = -414.6902 z = -417.8318 z = -420.9734 z = -424.1150 z = -427.2566 z = -430.3982 z = -433.5398 z = -436.6814 z = -439.8230 z = -442.9646 z = -446.1062 z = -449.2477 z = -452.3893 z = -455.5309 z = -458.6725 z = -461.8141 z = -464.9557 z = -468.0973 z = -471.2389 z = -474.3805 z = -477.5221 z = -480.6637 z = -483.8053 z = -486.9469 z = -490.0885 z = -493.2300 z = -496.3716 z = -499.5132 z = -502.6548 z = -505.7964 z = -508.9380 z = -512.0796 z = -515.2212 z = -518.3628 z = -521.5044 z = -524.6460 z = -527.7876 z = -530.9292 z = -534.0708 z = -537.2123 z = -540.3539 z = -543.4955 z = -546.6371 z = -549.7787 z = -552.9203 z = -556.0619 z = -559.2035 z = -562.3451 z = -565.4867 z = -568.6283 z = -571.7699 z = -574.9115 z = -578.0530 z = -581.1946 z = -584.3362 z = -587.4778 z = -590.6194 z = -593.7610 z = -596.9026 z = -600.0442 z = -603.1858 z = -606.3274 z = -609.4690 z = -612.6106 z = -615.7522 z = -618.8938 z = -622.0353 z = -625.1769 z = -628.3185 z = -631.4601 z = -634.6017 z = -637.7433 z = -640.8849 z = -644.0265 z = -647.1681 z = -650.3097 z = -653.4513 z = -656.5929 z = -659.7345 z = -662.8760 z = -666.0176 z = -669.1592 z = -672.3008 z = -675.4424 z = -678.5840 z = -681.7256 z = -684.8672 z = -688.0088 z = -691.1504 z = -694.2920 z = -697.4336 z = -700.5752 z = -703.7168 z = -706.8583 z = -709.9999 z = -713.1415 z = -716.2831 z = -719.4247 z = -722.5663 z = -725.7079 z = -728.8495 z = -731.9911 z = -735.1327 z = -738.2743 z = -741.4159 z = -744.5575 z = -747.6991 z = -750.8406 z = -753.9822 z = -757.1238 z = -760.2654 z = -763.4070 z = -766.5486 z = -769.6902 z = -772.8318 z = -775.9734 z = -779.1150 z = -782.2566 z = -785.3982 z = -788.5398 z = -791.6813 z = -794.8229 z = -797.9645 z = -801.1061 z = -804.2477 z = -807.3893 z = -810.5309 z = -813.6725 z = -816.8141 z = -819.9557 z = -823.0973 z = -826.2389 z = -829.3805 z = -832.5221 z = -835.6636 z = -838.8052 z = -841.9468 z = -845.0884 z = -848.2300 z = -851.3716 z = -854.5132 z = -857.6548 z = -860.7964 z = -863.9380 z = -867.0796 z = -870.2212 z = -873.3628 z = -876.5044 z = -879.6459 z = -882.7875 z = -885.9291 z = -889.0707 z = -892.2123 z = -895.3539 z = -898.4955 z = -901.6371 z = -904.7787 z = -907.9203 z = -911.0619 z = -914.2035 z = -917.3451 z = -920.4866 z = -923.6282 z = -926.7698 z = -929.9114 z = -933.0530 z = -936.1946 z = -939.3362 z = -942.4778 z = -945.6194 z = -948.7610 z = -951.9026 z = -955.0442 z = -958.1858 z = -961.3274 z = -964.4689 z = -967.6105 z = -970.7521 z = -973.8937 z = -977.0353 z = -980.1769 z = -983.3185 z = -986.4601 z = -989.6017 z = -992.7433 z = -995.8849 z = -999.0265 z = -1.0022e+03 z = -1.0053e+03 z = -1.0085e+03 z = -1.0116e+03 z = -1.0147e+03 z = -1.0179e+03 z = -1.0210e+03 z = -1.0242e+03 z = -1.0273e+03 z = -1.0304e+03 z = -1.0336e+03 z = -1.0367e+03 z = -1.0399e+03 z = -1.0430e+03 z = -1.0462e+03 z = -1.0493e+03 z = -1.0524e+03 z = -1.0556e+03 z = -1.0587e+03 z = -1.0619e+03 z = -1.0650e+03 z = -1.0681e+03 z = -1.0713e+03 z = -1.0744e+03 z = -1.0776e+03 z = -1.0807e+03 z = -1.0838e+03 z = -1.0870e+03 z = -1.0901e+03 z = -1.0933e+03 z = -1.0964e+03 z = -1.0996e+03 z = -1.1027e+03 z = -1.1058e+03 z = -1.1090e+03 z = -1.1121e+03 z = -1.1153e+03 z = -1.1184e+03 z = -1.1215e+03 z = -1.1247e+03 z = -1.1278e+03 z = -1.1310e+03 z = -1.1341e+03 z = -1.1373e+03 z = -1.1404e+03 z = -1.1435e+03 z = -1.1467e+03 z = -1.1498e+03 z = -1.1530e+03 z = -1.1561e+03 z = -1.1592e+03 z = -1.1624e+03 z = -1.1655e+03 z = -1.1687e+03 z = -1.1718e+03 z = -1.1750e+03 z = -1.1781e+03 z = -1.1812e+03 z = -1.1844e+03 z = -1.1875e+03 z = -1.1907e+03 z = -1.1938e+03 z = -1.1969e+03 z = -1.2001e+03 z = -1.2032e+03 z = -1.2064e+03 z = -1.2095e+03 z = -1.2127e+03 z = -1.2158e+03 z = -1.2189e+03 z = -1.2221e+03 z = -1.2252e+03 z = -1.2284e+03 z = -1.2315e+03 z = -1.2346e+03 z = -1.2378e+03 z = -1.2409e+03 z = -1.2441e+03 z = -1.2472e+03 z = -1.2504e+03 z = -1.2535e+03 z = -1.2566e+03 z = -1.2598e+03 z = -1.2629e+03 z = -1.2661e+03 z = -1.2692e+03 z = -1.2723e+03 z = -1.2755e+03 z = -1.2786e+03 z = -1.2818e+03 z = -1.2849e+03 z = -1.2881e+03 z = -1.2912e+03 z = -1.2943e+03 z = -1.2975e+03 z = -1.3006e+03 z = -1.3038e+03 z = -1.3069e+03 z = -1.3100e+03 z = -1.3132e+03 z = -1.3163e+03 z = -1.3195e+03 z = -1.3226e+03 z = -1.3258e+03 z = -1.3289e+03 z = -1.3320e+03 z = -1.3352e+03 z = -1.3383e+03 z = -1.3415e+03 z = -1.3446e+03 z = -1.3477e+03 z = -1.3509e+03 z = -1.3540e+03 z = -1.3572e+03 output = -1.3572e+03 ```