How do I organize digits of a int number in C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How do I organize digits of a int number in C++?

How can I organize the digits of a number, for example, organize the number 2835 in 2358 or 8532 ??

7th Jun 2018, 1:04 AM
vic
vic - avatar
3 Answers
7th Jun 2018, 2:13 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
First, convert to string, then sort them
7th Jun 2018, 2:10 AM
Owenizedd
Owenizedd - avatar
7th Jun 2018, 1:07 PM
vic
vic - avatar