Cody

# Problem 813. Multiply 2 numbers

Solution 216889

Submitted on 13 Mar 2013
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   Fail
%% 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')))

```Error: Assertion failed. ```

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 z = 3.7245e+03 z = 4011 z = 4.2975e+03 z = 4584 z = 4.8705e+03 z = 5157 z = 5.4435e+03 z = 5730 z = 6.0165e+03 z = 6303 z = 6.5895e+03 z = 6876 z = 7.1625e+03 z = 7449 z = 7.7355e+03 z = 8022 z = 8.3085e+03 z = 8595 z = 8.8815e+03 z = 9168 z = 9.4545e+03 z = 9741 output = 9741 ```

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 z = -1.3603e+03 z = -1.3635e+03 z = -1.3666e+03 z = -1.3697e+03 z = -1.3729e+03 z = -1.3760e+03 z = -1.3792e+03 z = -1.3823e+03 z = -1.3854e+03 z = -1.3886e+03 z = -1.3917e+03 z = -1.3949e+03 z = -1.3980e+03 z = -1.4012e+03 z = -1.4043e+03 z = -1.4074e+03 z = -1.4106e+03 z = -1.4137e+03 z = -1.4169e+03 z = -1.4200e+03 z = -1.4231e+03 z = -1.4263e+03 z = -1.4294e+03 z = -1.4326e+03 z = -1.4357e+03 z = -1.4388e+03 z = -1.4420e+03 z = -1.4451e+03 z = -1.4483e+03 z = -1.4514e+03 z = -1.4546e+03 z = -1.4577e+03 z = -1.4608e+03 z = -1.4640e+03 z = -1.4671e+03 z = -1.4703e+03 z = -1.4734e+03 z = -1.4765e+03 z = -1.4797e+03 z = -1.4828e+03 z = -1.4860e+03 z = -1.4891e+03 z = -1.4923e+03 z = -1.4954e+03 z = -1.4985e+03 z = -1.5017e+03 z = -1.5048e+03 z = -1.5080e+03 z = -1.5111e+03 z = -1.5142e+03 z = -1.5174e+03 z = -1.5205e+03 z = -1.5237e+03 z = -1.5268e+03 z = -1.5300e+03 z = -1.5331e+03 z = -1.5362e+03 z = -1.5394e+03 z = -1.5425e+03 z = -1.5457e+03 z = -1.5488e+03 output = -1.5488e+03 ```