How to reverse digits of a number in decending order and avoid repeated numbers without array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to reverse digits of a number in decending order and avoid repeated numbers without array?

9th Oct 2018, 10:43 AM
Ali koushyar
Ali koushyar - avatar
5 Answers
+ 1
you could use a string to loop over instead of an array, int len = strlen( source ); for (i = 0; i < len; i++){ }
9th Oct 2018, 12:40 PM
Willem Roos
+ 1
lets change it this way, i almost asked incorrectly. i need an app to get a number and generate a new number with the previous ones digits from the biggest to lowest , and also remove the digits which used once. i.e : >> 29755 >> 9752
9th Oct 2018, 2:42 PM
Ali koushyar
Ali koushyar - avatar
+ 1
Ali, do you have a code in progress, I just want to see to know how far you have gone through this, so no overlapping in steps. If there's a code please save in profile and attach its URL in the Description part of the original post. And is there a restriction to what was allowed to use and not, apart from the array of course.
9th Oct 2018, 4:52 PM
Ipang
0
What do you mean by descending order? when you reverse a number's digits the position of digits are inverted, and why should you skip repetitive digits? and lastly, what if the number is Palindrome? e.g. 545.
9th Oct 2018, 1:39 PM
Ipang
0
very easy.. i usually use for loops and substring for this. so <string> is needed.
13th Oct 2018, 12:25 AM
Kuyondo
Kuyondo - avatar