Create largest N digit number

3 次查看(过去 30 天)
DJ V
DJ V 2016-12-8
评论: Jan 2016-12-8
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
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Automated Driving Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by