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

조회 수: 1 (최근 30일)
e.g., from 7465 :
The digits = 7, 4, 6, and 5, so:
Minimum = 4567, the maximum = 7654

채택된 답변

Iman Ansari
Iman Ansari 2013년 5월 12일
Hi.
A=7465;
A=num2str(A)';
Minimum=str2num(sort(A)')
maximum=str2num(sort(A,'descend')')
  댓글 수: 3

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Elementary Math에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by