+ 7

Need help in a algorithm.

I can't create a algorithm for this problem : Take input of number consisting of four digits. generate the maximum and minimum numbers using the four digits entered. Try it for 2005.

22nd Jul 2019, 12:39 PM
Manoj
Manoj - avatar
10 Antworten
+ 5
~ swim ~ thanks man👍
22nd Jul 2019, 1:39 PM
Manoj
Manoj - avatar
+ 4
22nd Jul 2019, 12:57 PM
Manoj
Manoj - avatar
+ 4
in c++ you can make a vector of these 4 digits . and then sort it for example/ vector<int> digits; //for minimum sort(digits.begin(), digits.end()); //for maximum sort(digits.end(), digits.begin());
23rd Jul 2019, 8:35 AM
Divij Manik
Divij Manik - avatar
+ 3
Use array with 4 numbers. Sort the array. Get numbers for index 0 and 3. Use List in Python. 🤔
22nd Jul 2019, 3:06 PM
Sanjay Kamath
Sanjay Kamath - avatar
22nd Jul 2019, 5:14 PM
Kuri
Kuri - avatar