下边JAVA程序哪里错了请帮我纠正下谢谢!另外每句话的意思是什么帮帮帮忙啊看不太懂!
importjava.io.*;publicclassPrintWriter{publicstaticvoidmain(Stringargs[]){longprimes[...
import java.io.*;
public class PrintWriter {
public static void main(String args[]) {
long primes[] = new long[20];
primes[0] = 2;
primes[1] = 3;
int count = 2;
long number = 5;
outer:
for(;count<primes.length;number+=2) {
long limit = (long)Math.ceil(Math.sqrt((double)number));
for(int i=1;i<count&&primes[i]<=limit;i++)
if(number%primes[i] == 0)
continue outer;
primes[count++] = number;
}
PrintWriter output = new PrintWriter(System.out,true);
for(int i=0;i<primes.length;i++)
output.print((i%5==0? "\n":" ")+ primes[i]);
output.close();
}
} 展开
public class PrintWriter {
public static void main(String args[]) {
long primes[] = new long[20];
primes[0] = 2;
primes[1] = 3;
int count = 2;
long number = 5;
outer:
for(;count<primes.length;number+=2) {
long limit = (long)Math.ceil(Math.sqrt((double)number));
for(int i=1;i<count&&primes[i]<=limit;i++)
if(number%primes[i] == 0)
continue outer;
primes[count++] = number;
}
PrintWriter output = new PrintWriter(System.out,true);
for(int i=0;i<primes.length;i++)
output.print((i%5==0? "\n":" ")+ primes[i]);
output.close();
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询