java - Any ways to find out "beautiful numbers" -
a beautiful number number containing 1 type of digit, such these: 0
, 4
, 44
, 55555
, 3333
.
i write android app finds out if number beautiful or not.
try check how many digits number has, example number has 5 digits(between 10000-99999 , >= 11111)
if(num % 11111 == 0){ //it beautiful number }else{ //it not beautiful }
this example 5 digit numbers. can develop algorithm checking other num of digits. don't know there algorithm created before.
Comments
Post a Comment