Cody

# Problem 813. Multiply 2 numbers

Solution 2026249

Submitted on 18 Nov 2019 at 10:32
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')

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

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

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

o = 0

Assertion failed.

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

o = 0 o = 286.5000 o = 573 o = 859.5000 o = 1146 o = 1.4325e+03 o = 1719 o = 2.0055e+03 o = 2292 o = 2.5785e+03 o = 2865 o = 3.1515e+03 o = 3438 o = 3.7245e+03 o = 4011 o = 4.2975e+03 o = 4584 o = 4.8705e+03 o = 5157 o = 5.4435e+03 o = 5730 o = 6.0165e+03 o = 6303 o = 6.5895e+03 o = 6876 o = 7.1625e+03 o = 7449 o = 7.7355e+03 o = 8022 o = 8.3085e+03 o = 8595 o = 8.8815e+03

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

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