package cn.tedu.demo;
import java.util.Scanner;
public class Demo07170203test03 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println(“请输入一个整数”);
int mun = sc.nextInt();
int i = 0;
do {
mun = mun/10;
i++;
} while (mun!= 0 );
//当型和直到型条件应该一致
System.out.println(i);
}
}
记录整数的位数
最新推荐文章于 2024-09-02 22:33:56 发布