+ 1

How to know the digit of int number ?

We have (7641)it's int number!!! 1) 7641 ---> 4 \\its num of digit 2) 7641 ---> 7614 \\exchange 3) 7641 ---> 1647 \\exchange 4) 7641 ---> 8752 \\+1 5) 7641 ---> 6530 \\-1 6) 7641 ---> 18 \\sum 7) 7641 ---> 6641 \\7-1 8) 7641 ---> 7641 \\exchange 9) 7641 ---> 8 \\7+1 \\f+end 10) 7641 ---> 1467 \\reverse

4th Mar 2017, 5:01 AM
Saman M Dusky
Saman M Dusky - avatar
1 Answer
+ 1
boolean stillsearching = true; int number = 1; //just to check int numberOfDigits = 0; int ourNumber = 4018; //or whatever while (stillesearching){ if (numberOfDigits > 1000) break; //just to prove // its not a endless loop if (ourNumber/numer >= 1){ numberOfDigits ++; number *= 10; //to get one digit higher }else { return numberOfDigits; // if its a function stillsearching = false; } }
4th Mar 2017, 5:46 AM
Samxamnam
Samxamnam - avatar