Cody

# Problem 985. Make a Star Pyramid

Solution 1999427

Submitted on 2 Nov 2019
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   Fail
n = 2; p = ['* ';'**']; assert(isequal(pyramid(n),p));

a = [] a = 42 p = '*' a = [] a = 42 42

Error using vertcat Dimensions of arrays being concatenated are not consistent. Error in pyramid (line 6) p=[p;a] Error in Test1 (line 3) assert(isequal(pyramid(n),p));

2   Fail
n = 3; p = ['* ';'** ';'***']; assert(isequal(pyramid(n),p));

a = [] a = 42 p = '*' a = [] a = 42 42

Error using vertcat Dimensions of arrays being concatenated are not consistent. Error in pyramid (line 6) p=[p;a] Error in Test2 (line 3) assert(isequal(pyramid(n),p));

3   Fail
n = 4; p = ['* ';'** ';'*** ';'****']; assert(isequal(pyramid(n),p));

a = [] a = 42 p = '*' a = [] a = 42 42

Error using vertcat Dimensions of arrays being concatenated are not consistent. Error in pyramid (line 6) p=[p;a] Error in Test3 (line 3) assert(isequal(pyramid(n),p));

4   Fail
n = 10; p = ['* '; '** '; '*** '; '**** '; '***** '; '****** '; '******* '; '******** '; '********* '; '**********']; assert(isequal(pyramid(n),p));

a = [] a = 42 p = '*' a = [] a = 42 42

Error using vertcat Dimensions of arrays being concatenated are not consistent. Error in pyramid (line 6) p=[p;a] Error in Test4 (line 12) assert(isequal(pyramid(n),p));