We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e8f48c2 commit a5c09c2Copy full SHA for a5c09c2
src/main/java/com/dev/number/operations/DigitsCountInNumber.java
@@ -0,0 +1,21 @@
1
+package com.dev.number.operations;
2
+
3
+public class DigitsCountInNumber {
4
5
+ public static int getDigitCountOf(int number){
6
+ int count = 0;
7
+ while (number != 0){
8
+ number = number / 10;
9
+ count++;
10
+ }
11
+ return count;
12
13
14
+ public static void main(String[] args) {
15
16
+ int number = 1765712349;
17
+ int digitCount = getDigitCountOf(number);
18
+ System.out.println("digitCount = " + digitCount);
19
20
21
+}
0 commit comments