输入999,则输出 “它是个3位的数!”
输入999,则输出 “它是个3位的数!”
HelloWorld.java
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
输入999,则输出 “它是个3位的数!”
HelloWorld.java
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
2017-03-02
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
if(num<=999999999){
if(num>=99999999){
count = 9;
} else if(num>9999999){
count = 8;
} else if(num>999999){
count=7;
} else if(num>99999){
count=6;
} else if(num>9999){
count=5;
} else if(num>999){
count=4;
} else if(num>99){
count=3;
} else if(num>9){
count=2;
}else if(num>0){
count=1;
}
}
System.out.println("它是个"+count+"位的数!");
举报