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

2 ビュー (過去 30 日間)
Oskore Mune
Oskore Mune 2018 年 6 月 4 日
回答済み: Kodavati Mahendra 2018 年 6 月 5 日
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
Kodavati Mahendra 2018 年 6 月 5 日
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 Center および File ExchangeGraph and Network Algorithms についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by