Cody

# Problem 44467. Product of Each Column

Solution 1400174

Submitted on 1 Jan 2018 by Yair Fridman
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))

c = 1 v = 1 a = 1 c = 1 v = 1 1 a = 1 c = 1 v = 1 1 1 a = 1 c = 1 v = 1 1 1 1 a = 1 c = 1 v = 1 1 1 1 1 a = 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)))

c = 10 v = 10 a = 1 c = 36 v = 10 36 a = 1 c = 84 v = 10 36 84 a = 1 c = 40 v = 10 36 84 40 a = 1

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

c = 5400 v = 5400 a = 1 c = 1920 v = 5400 1920 a = 1 c = 1920 v = 5400 1920 1920 a = 1 c = 500 v = 5400 1920 1920 500 a = 1 c = 1440 v = 5400 1920 1920 500 1440 a = 1 c = 12288 v = 5400 1920 1920 500 1440 12288 a = 1 c = 3000 v = 5400 1920 1920 500 1440 12288 3000 a = 1 c = 3200 v = 5400 1920 1920 500 1440 12288 3000 3200 a = 1 c = 16000 v = 5400 1920 1920 500 1440 12288 3000 3200 16000 a = 1 c = 2400 v = 5400 1920 1920 500 1440 12288 3000 3200 16000 2400 a = 1