Cody

# Problem 44467. Product of Each Column

Solution 2072705

Submitted on 28 Dec 2019 by malik malichov
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
filetext = fileread('myProd.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')

2   Pass
filetext = fileread('myProd.m'); assert(isempty(strfind(filetext, 'prod')),'Cannot use prod() function')

3   Pass
mat = ones(5); v_correct = ones(1, 5); assert(isequal(myProd(mat),v_correct))

m = 5 n = 5 v = [] v = 1 v = 1 1 v = 1 1 1 v = 1 1 1 1 v = 1 1 1 1 1

4   Pass
mat = [ 1, 2, 3, 4; 5, 6, 7, 2; 2, 3, 4, 5]; v_correct = [10, 36, 84, 40]; assert(isequal(myProd(mat),prod(mat)))

m = 3 n = 4 v = [] v = 10 v = 10 36 v = 10 36 84 v = 10 36 84 40

5   Pass
m = randi([5,15]); n = randi([5,15]); mat = randi(5, n, m); v_correct = prod(mat); assert(isequal(myProd(mat),prod(mat)))

m = 13 n = 15 v = [] v = 135000 v = 135000 153600 v = 135000 153600 172800 v = 135000 153600 172800 1105920 v = 135000 153600 172800 1105920 960000 v = 135000 153600 172800 1105920 960000 777600 v = 135000 153600 172800 1105920 960000 777600 25920 v = 135000 153600 172800 1105920 960000 777600 25920 43200 v = 135000 153600 172800 1105920 960000 777600 25920 43200 4050000 v = 135000 153600 172800 1105920 960000 777600 25920 43200 4050000 600000 v = 135000 153600 172800 1105920 960000 777600 25920 43200 4050000 600000 311040 v = 135000 153600 172800 1105920 960000 777600 25920 43200 4050000 600000 311040 3000 v = 135000 153600 172800 1105920 960000 777600 25920 43200 4050000 600000 311040 3000 230400 v = 135000 153600 172800 1105920 960000 777600 25920 43200 4050000 600000 311040 3000 230400 307200 v = 135000 153600 172800 1105920 960000 777600 25920 43200 4050000 600000 311040 3000 230400 307200 921600