为什么一定要循环,这样不是更简单!~
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
int a=num%100;
if(a>=1|a<=9){
System.out.println("它是个3位的数!") ;
}
}
}
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
int a=num%100;
if(a>=1|a<=9){
System.out.println("它是个3位的数!") ;
}
}
}
2018-10-29
import java.util.Scanner;
public class HelloWorld{
public static void main(String[] args){
int num =1; int count = 0;
Scanner scanner=new Scanner(System.in);
System.out.println("输入一个不超过十位数的数")
int a=scanner.nextInt();
for(;num<=10;i++)
{count=a%10; a=a-count;
if(a>=10)
{a=a/10;}
else
{System.out.println("是"+num+"个数");break;}
}
}
}
举报