早教吧 育儿知识 作业答案 考试题库 百科 知识分享

假设有一条绳子长3000m,每天减去一半publicclasschapter337{publicstaticvoidmain(Stringargs[]){inti=0;booleanboo=true;intlength=3000;while(boo){if(length

题目详情
假设有一条绳子长3000m,每天减去一半
public class chapter337 {
public static void main(String args[])
{
int i=0;
boolean boo=true;
int length=3000;
while(boo)
{
if(length
▼优质解答
答案和解析

多了一组括号

class chapter337 {
public static void main(String args[]) {
int i = 0;
boolean boo = true;
int length = 3000;
while (boo) {
if (length < 5) {
boo = false;
}
int len2 = length - length / 2;
length = len2;
i++;
}
System.out.print(i + "天后绳子小于5M");
}
}