2021年8月28日
摘要: 1 //100以内的质数的输出(从2开始,到这个数-1结束为止,都不能被这个数本身整除) 2 boolean isFlag = true; //标识i是否被j除尽,修改其值 3 4 for(int i =2; i<=100;i++) 5 { 6 for(int j = 2;j < i;j++) 7 阅读全文
posted @ 2021-08-28 18:22 Bytezero! 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 1 //9*9乘法表 2 3 for(int i =1;i<10;i++) 4 { 5 for(int j = 1;j <=i;j++) 6 { 7 System.out.print(i+"*"+j+"="+i*j+"\t"); 8 } 9 System.out.println(); 10 } 阅读全文
posted @ 2021-08-28 16:28 Bytezero! 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 3 * 4 ** 5 *** 6 **** 7 ***** 8 9 */ 10 11 for(int i = 1; i <=5;i++) 12 { 13 for(int j = 1;j<=i;j++) 14 { 15 System.out.print("*"); 16 } 17 Sys 阅读全文
posted @ 2021-08-28 16:15 Bytezero! 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 1 /** 2 * 从键盘输入不确定的整数 并判断读入的整数和负数的个数,输入0时候结束 3 * 4 */ 5 6 Scanner scan = new Scanner(System.in); 7 8 int posituveNumber = 0; //记录正数的个数 9 int negativeN 阅读全文
posted @ 2021-08-28 15:39 Bytezero! 阅读(543) 评论(0) 推荐(0) 编辑
摘要: 1 //输入两个正整数m和n,求其最大的公约数和最小公倍数 2 //12和20的最大公约数是4,最小公倍数是60 3 4 Scanner scan = new Scanner(System.in); 5 6 System.out.println("请输第一个正整数:"); 7 int m = sca 阅读全文
posted @ 2021-08-28 14:43 Bytezero! 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 1 //在150之内 是三的倍数 输出Zzz 是5个倍数输出 Lll 是7的倍数输出zlzl 2 int i =1; 3 for(i = 1; i<=150;i++) 4 { 5 System.out.print(i+" "); 6 7 if(i%3==0) 8 { 9 System.out.pri 阅读全文
posted @ 2021-08-28 13:45 Bytezero! 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 1 //遍历100以内的偶数,获取所有偶数的和,输出偶数的个数 2 3 int i =1; 4 int sum = 0; 5 int count = 0; 6 for(i = 1;i<=100;i++) 7 { 8 if(i%2==0) 9 { 10 System.out.println(i); 1 阅读全文
posted @ 2021-08-28 10:36 Bytezero! 阅读(1040) 评论(0) 推荐(0) 编辑
摘要: 1 /** 2 * 编写程序: 3 * 从键盘上输入"year"“month”和“day”,要求通过程序输出 4 * 输入的日期为第几年的第几天 5 * 注:判断一年是否是闰年的标准: 6 * 可以被4整除,但不可被100整除 7 * 或 8 * 可以被400整除 9 * 10 */ 11 12 1 阅读全文
posted @ 2021-08-28 10:02 Bytezero! 阅读(747) 评论(0) 推荐(1) 编辑