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

on 11 May 2013

### Iman Ansari (view profile)

e.g., from 7465 :

The digits = 7, 4, 6, and 5, so:

Minimum = 4567, the maximum = 7654

## Tags

No tags are associated with this question.

## Products

No products are associated with this question.

### Iman Ansari (view profile)

on 12 May 2013

Hi.

A=7465;
A=num2str(A)';
Minimum=str2num(sort(A)')
maximum=str2num(sort(A,'descend')')

chathura

### chathura (view profile)

on 13 May 2013

if it is necessary, to program counted how many of these steps need to do to get the number 6574, how can I do this with that....

Iman Ansari

### Iman Ansari (view profile)

on 13 May 2013

I don't understand.

Iman Ansari

### Iman Ansari (view profile)

on 13 May 2013
A=7465;
A=num2str(A)';
A_sort=sort(A);
New=str2num([A_sort([3 2 4 1])]')

#### Join the 15-year community celebration.

Play games and win prizes!

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi