I don't know how to code this number triangle

1 回表示 (過去 30 日間)
Ye
Ye 2022 年 10 月 29 日
回答済み: KSSV 2022 年 10 月 29 日
How to Code this following number triangle below??

採用された回答

KSSV
KSSV 2022 年 10 月 29 日
n = [1 11 111 1111 11111 111111 1111111];
for i = 1 : length(n)
x = num2str(n(i)^2);
s = [blanks(length(n)-i) x];
fprintf('%s\n',s)
end
1 121 12321 1234321 123454321 12345654321 1234567654321

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComputational Geometry についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by