Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = ones(4,4);
y_correct = [1 0 0 0; 1 1 0 0; 1 1 1 0; 1 1 1 1];
assert(isequal(triangle(x),y_correct))
|
2 | Pass |
x = ones(5,5);
y_correct = [1 0 0 0 0; 1 1 0 0 0; 1 1 1 0 0; 1 1 1 1 0; 1 1 1 1 1];
assert(isequal(triangle(x),y_correct))
|
3 | Pass |
x = reshape(1:16,[4,4]);
y_correct = [1 2 3 4; 0 6 7 8; 0 0 11 12; 0 0 0 16]';
assert(isequal(triangle(x),y_correct))
|
4 | Pass |
x = [0 1 2 3; 0 0 1 2; 0 0 0 1; 0 0 0 0];
y_correct = zeros(4);
assert(isequal(triangle(x),y_correct))
|
829 Solvers
Determine if a Given Number is a Triangle Number
322 Solvers
2314 Solvers
2617 Solvers
Calculate Amount of Cake Frosting
7505 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!