import java.util.Scanner;
public class HelloWorld {
public static void main(String[] args)
{
Scanner scan=new Scanner(System.in);
System.out.println("请输入数字");
int num=scan.nextInt();
int count = 0;
for(int i=1000000000;i>0;)
{
if(num/i>0)
{
count++;
}i=i/10;
}System.out.println("它是个"+count+"位的数");
}
}
代码没错,需要输入才能给出结果