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 comentario

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

Iniciar sesión para comentar.

Respuestas (1)

Chaya N
Chaya N el 8 de Dic. de 2016
Editada: Chaya N el 8 de Dic. de 2016

0 votos

Try this
(10^N) - 1

1 comentario

Jan
Jan el 8 de Dic. de 2016
Please let the OP solve his homework by his own. If the solutions are posted, they cannot provided without cheating anymore.

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with MATLAB en Centro de ayuda y File Exchange.

Preguntada:

el 8 de Dic. de 2016

Comentada:

Jan
el 8 de Dic. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by