From four different numbers, how can I find out the minimum and maximum numbers that can created from the digits?

1 visualización (últimos 30 días)
e.g., from 7465 :
The digits = 7, 4, 6, and 5, so:
Minimum = 4567, the maximum = 7654

Respuesta aceptada

Iman Ansari
Iman Ansari el 12 de Mayo de 2013
Hi.
A=7465;
A=num2str(A)';
Minimum=str2num(sort(A)')
maximum=str2num(sort(A,'descend')')
  3 comentarios

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Elementary Math en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by