HW6.6

public class Solution
{
public static void main(String[] args)
{
int[] prime = new int[50];
prime[0] = 2;
int i = 0;
int j = 3;
boolean judgment = false;
while(true)
{
i = 0;
while(i < 50 && prime[i] != 0)
{
if(j % prime[i] == 0)
{
judgment = false;
break;
}
i++;
}
for(int k = 0; k < 50; k++)
{
if(judgment == true && prime[k] == 0)
{
prime[k] = j;
break;
}
}
judgment = true;
j++;
if(prime[prime.length - 1] != 0)
break;
}
int count = 0;
for(int k = 0; k < 50; k++)
{
System.out.print(prime[k] + " ");
count++;
if(count == 10)
{
System.out.println();
count = 0;
}
}
}
}
HW6.6的更多相关文章
- HW6.30
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW6.29
public class Solution { public static void main(String[] args) { int count = 0; int[] card = new int ...
- HW6.28
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW6.27
import java.util.Scanner; import java.util.Arrays; public class Solution { public static void main(S ...
- HW6.26
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW6.25
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW6.24
public class Solution { public static void main(String[] args) { int count = 0; int color; int numbe ...
- HW6.23
public class Solution { public static void main(String[] args) { boolean[] box = new boolean[101]; f ...
- HW6.22
import java.util.Arrays; public class Solution { public static void main(String[] args) { int[][] ch ...
- HW6.21
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
随机推荐
- 软件调试之INT 3讲解
第4章断点和单步执行 断点和单步执行是两个经常使用的调试功能,也是调试器的核心功能.本章我们将介绍IA-32 CPU是如何支持断点和单步执行功能的.前两节将分别介绍软件断点和硬件断点,第4.3节介绍用 ...
- 破解之API断点法
上回给大家做的破解教程,地址是http://www.52pojie.net/thread-52719-1-1.html,用的是“调用堆栈”方法.今天给新手提供另一种方法“API函数断点”,这种方法要求 ...
- nginx面试题
1.Nginx是如何实现高并发的 service nginx start之后,然后输入#ps -ef|grep nginx,会发现Nginx有一个master进程和若干个worker进程,这些work ...
- spring的组成
① Spring Core:核心容器,BeanFactory提供了组件生命周期的管理,组件的创建,装配,销毁等功能 SpringContext:ApplicationContext,扩展核心容器,提供 ...
- MyBatis的分页操作(MySQL)
1.无条件分页: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC ...
- Android 监听EditView中的文本改变事件
android中的编辑框EditText也比较常用,那比如在搜索框中,没输入一个字,下面的搜索列表就显示有包含输入关键字的选项,这个输入监听怎么实现的呢? 我们可以建一个例子,效果图如下: 我们可以监 ...
- log4j:ERROR A "org.jboss.logging.appender.FileAppender" object is not assignable to a "org.apache.lo .
log4j:ERROR A "org.jboss.logging.appender.FileAppender" object is not assignable to a &quo ...
- (组合数学3.1.2.2)POJ 2084 Game of Connections(卡特兰数公示的实现)
package com.njupt.acm; import java.math.BigInteger; import java.util.Scanner; public class POJ_2084 ...
- python中的commands模块,执行出错:'{' 不是内部或外部命令,也不是可运行的程序 或批处理文件。
最近发现了python的commands模块,查看了下源码,使用的popen封装的,形成三个函数getstatus(), getoutput(), getstatusoutput() 源码如下: de ...
- 函数fseg_create_general
申请一个段 /**********************************************************************//** Creates a new segm ...