What part of my code do i change to print my triangle flipped?
2 ビュー (過去 30 日間)
古いコメントを表示
Hey so i am trying to print this triangle
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/191012/image.png)
, but I only got this far
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/191013/image.png)
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
0 件のコメント
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Graph and Network Algorithms についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!