Cody

# Problem 985. Make a Star Pyramid

Solution 3163771

Submitted on 11 Oct 2020 by A C
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
n = 2; p = ['* ';'**']; assert(isequal(pyramid(n),p));

p = '* ' p = 2×2 char array '* ' '**'

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

p = '* ' p = 2×3 char array '* ' '** ' p = 3×3 char array '* ' '** ' '***'

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

p = '* ' p = 2×4 char array '* ' '** ' p = 3×4 char array '* ' '** ' '*** ' p = 4×4 char array '* ' '** ' '*** ' '****'

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

p = '* ' p = 2×10 char array '* ' '** ' p = 3×10 char array '* ' '** ' '*** ' p = 4×10 char array '* ' '** ' '*** ' '**** ' p = 5×10 char array '* ' '** ' '*** ' '**** ' '***** ' p = 6×10 char array '* ' '** ' '*** ' '**** ' '***** ' '****** ' p = 7×10 char array '* ' '** ' '*** ' '**** ' '***** ' '****** ' '******* ' p = 8×10 char array '* ' '** ' '*** ' '**** ' '***** ' '****** ' '******* ' '******** ' p = 9×10 char array '* ' '** ' '*** ' '**** ' '***** ' '****** ' '******* ' '******** ' '********* ' p = 10×10 char array '* ' '** ' '*** ' '**** ' '***** ' '****** ' '******* ' '******** ' '********* ' '**********'

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!