Draw a triangle of ones - MATLAB Cody - MATLAB Central

Problem 55135. Draw a triangle of ones

Difficulty:Rate
For any given n, return a matrix that includes a triangle of ones of height n:
Example
n = 3
output = [0,0,1,0,0
0,1,1,1,0
1,1,1,1,1]

Solution Stats

75.86% Correct | 24.14% Incorrect
Last Solution submitted on Jan 15, 2025

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers21

Suggested Problems

Problem Tags

Community Treasure Hunt

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

Start Hunting!
Go to top of page