摘要: 代码如下: public class TestDemo { public static void main(String[] args) { //完数的计算机。例子:6 =1+2+3 一个数等于它的各个公约数的和 int factor =0; for(int i=1;i<=1000;i++){ // 阅读全文
posted @ 2016-07-26 16:48 caocx 阅读(554) 评论(0) 推荐(0) 编辑
摘要: //代码一: public class TestDemo { public static void main(String[] args) { //输出100以内的所有质数(素数,奇数),2是最小的质数 boolean flag =false; //计算时间 long star = System.c 阅读全文
posted @ 2016-07-26 16:33 caocx 阅读(546) 评论(0) 推荐(0) 编辑
摘要: 代码如下: public class TestDemo { public static void main(String[] args) { //输出100以内的所有质数(素数,奇数),2是最小的质数 boolean flag =false; //计算时间开始时间 long star = Syste 阅读全文
posted @ 2016-07-26 15:51 caocx 阅读(400) 评论(0) 推荐(0) 编辑
摘要: 代码如下:注,可以在原有的基础上,多加修改 public class TestJiuJiu { public static void main(String[] args) { for(int i =1;i<=9;i++){ for(int j=1;j<=i;j++){ // /t相当于table键 阅读全文
posted @ 2016-07-26 14:59 caocx 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 正三角形代码如下: * *** ***** *******-********* public class TestForWhile { public static void main(String[] args) { for(int i=0;i<5;i++){ for(int k=1;k<5-i;k 阅读全文
posted @ 2016-07-26 14:39 caocx 阅读(1646) 评论(0) 推荐(0) 编辑
摘要: 代码如下: import java.util.Scanner;class TestForWhile { public static void main(String[] args) { //注:无限循环的条件for(;;){},while(true){} Scanner scan = new Sca 阅读全文
posted @ 2016-07-26 10:21 caocx 阅读(377) 评论(0) 推荐(0) 编辑
摘要: 代码如下: import java.util.Scanner;public class TestForWhile { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int count=0 阅读全文
posted @ 2016-07-26 10:00 caocx 阅读(1575) 评论(0) 推荐(0) 编辑