I need to create an N digit number given only that it is N digits long.
For N = 2, this number would be two nines, or 99, for N = 3 the number would be 999, etc
Anyone know how to code this?

1 件のコメント

Geoff Hayes
Geoff Hayes 2016 年 12 月 8 日
編集済み: Geoff Hayes 2016 年 12 月 8 日
DJ - what have you tried so far? Please make an attempt at solving your homework questions before posting them on this forum.

サインインしてコメントする。

回答 (1 件)

Chaya N
Chaya N 2016 年 12 月 8 日
編集済み: Chaya N 2016 年 12 月 8 日

0 投票

Try this
(10^N) - 1

1 件のコメント

Jan
Jan 2016 年 12 月 8 日
Please let the OP solve his homework by his own. If the solutions are posted, they cannot provided without cheating anymore.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange で MATLAB についてさらに検索

質問済み:

2016 年 12 月 8 日

コメント済み:

Jan
2016 年 12 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by