input: an integer
output: digital count of the number
2019.12.11update:
需要考虑edge case 比如num=0
用do-while,while语句对0不适用
```java
import java.util.Scanner;
public class digitalCount {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("please enter a number:");
int number = in.nextInt();
int count = 0;
do {
number=number/10;
count=count+1;
}
while(number>0);
System.out.println("the digit of your entered number is: " + count);
}
}
原:
```java
import java.util.Scanner;
public class digitalCount {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("please enter a number:");
int number = in.nextInt();
int count = 0;
while(number>0) {
number=number/10;
count=count+1;
}
System.out.println("the digit of your entered number is: " + count);
}
}