Create largest N digit number

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 Comment

Geoff Hayes
Geoff Hayes on 8 Dec 2016
Edited: Geoff Hayes on 8 Dec 2016
DJ - what have you tried so far? Please make an attempt at solving your homework questions before posting them on this forum.

Sign in to comment.

Answers (1)

Chaya N
Chaya N on 8 Dec 2016
Edited: Chaya N on 8 Dec 2016
Try this
(10^N) - 1

1 Comment

Please let the OP solve his homework by his own. If the solutions are posted, they cannot provided without cheating anymore.

Sign in to comment.

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Asked:

on 8 Dec 2016

Commented:

Jan
on 8 Dec 2016

Community Treasure Hunt

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

Start Hunting!