What part of my code do i change to print my triangle flipped?

2 次查看(过去 30 天)
Hey so i am trying to print this triangle
, but I only got this far
What do I need to change in my code in order to flip it?
n=input('Enter rows for left triangle');
for i=2:n+1
for j=1:i-1
fprintf('*');
fprintf('');
end
fprintf('\n');
end

采纳的回答

Kodavati Mahendra
n=input('Enter rows for left triangle\n');
for i=1:n
for j=1:i
x(i,j) = '*';
end
end
disp(fliplr(x));

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graph and Network Algorithms 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by