I need to find the smallest number formed from the same digits of a given natural number n, using arrays.
dflor 0 Newbie Poster
Recommended Answers
Jump to Post— SgtMe 46Say you have the number:
251The smallest number from those digits will be:125Therefore: digit1 = smallest number, digit2 = next smallest, etc.Seperate the number into individual digits using an array. Find the smallest value and put this in the first index of a new array. …
Jump to Post— SgtMe 46Next time, please press the code button before you paste your code.
for (i=0; i<=9; i++){}Ever done a while loop before? Consider a loop which is
while (i<=9){}. At the end of the loop, you would havei++;to increment the value of …
All 6 Replies
alexchen -12 Junior Poster
SgtMe 46 Veteran Poster Featured Poster
dflor 0 Newbie Poster
SgtMe 46 Veteran Poster Featured Poster
dflor 0 Newbie Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.