MATLAB: How to add zeros above the numbers I created with this code

table of values

rows = 10;
for ii = 1 : rows
for jj = 1 : ii
b = jj;
if ii <= jj
fprintf('%d \n',b)
else
fprintf('%d ',b)
end
end
end
Result =
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10

Best Answer

Try this:
rows=10;
for i=1:rows
fprintf('%d ',[1:i zeros(1,rows-1)]);
fprintf('\n');
end