能帮我找出哪里出错了吗?
int num = 999;
int count = 0;
if (o<=num<=999999999){
count=count++;
for(;;count++){
if((num-Math.pow(10,count))<0)
continue;
}
}else{
System.out.println("数据不符合判断条件!")
}
System.out.println("它是个"+count+"位的数!")
}
}接上
package com.xuexi;
import java.lang.Math;
public class ShiYan{
public static void main(String args[]){
int num = 999;
int count = 0;
if (num>=0&&num<=999999999){//这不能这么写应该是num>=xx&&num<=xx
//count=count++;没有用在这里
for(;;count++){
if((num-Math.pow(10,count))<0){
break;
}
}
}else{
System.out.println("数据不符合判断条件!");//这少分号
}
System.out.println("它是个"+count+"位的数!");//这少分号
}
}
运行结果:它是个3位的数!
输出的地方少两个分号;if循环不能那么写.
用&&连接.
package javalx.com;
public class Lx03
{
public static void main(String[] args) {
int num = 999;
int count = 0;
{
if (num >=0 && num <=999999999){
count=count++;
for(;;count++){
if((num-Math.pow(10,count))<0)
continue;
}
}
else
{
System.out.println("数据不符合判断条件!");
}
System.out.println("它是个"+count+"位的数!");
}
}
}
//虽然没报错,但好像还是有点问题public static void main(String[] args){
int num = 999;
int count = 0;
if(num >=0 && num <=999999999) {
while(num != 0) {
count++;
num /=10;
}
System.out.println("它是个"+count + "位的数!");
} else {
System.out.println("输入有误!");
}
buzhidao a