+ 9
Find greatest and smallest digits in a given number
Write a program which takes a number as input and displays the greatest and smallest digits in that number For example, Input:527613 Output: Greatest digit:-->7 Smallest digit:-->1 đhere is mine with Java.... https://code.sololearn.com/cZJZj9eRqby5/?ref=app
6 Answers
+ 21
one more idea)take digits in an array & use Arrays.sort () , or convert it to a vhar array & do the same ... take element with index 0&(l-1)
+ 6
Python one line, following Gaurav's suggestion:
https://code.sololearn.com/c55VOqmRTm5U/#py
+ 3
@Ace Thanks!!
+ 2
https://code.sololearn.com/cepxF85MD0n1/?ref=app
+ 1
https://code.sololearn.com/cCgrV675wS2i/?ref=app
New one with a little modification as in the question