随笔分类 -  循环

摘要:public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("请输入一个正整数"); int... 阅读全文
posted @ 2018-07-24 15:06 张明洋 阅读(422) 评论(0) 推荐(0)
摘要:通过画图来了解 public static void main(String[] args) { /* 6 打印出如下图案(菱形) * *** ***** ******* ***** *** * *... 阅读全文
posted @ 2018-07-24 15:03 张明洋 阅读(109) 评论(0) 推荐(0)
摘要:分析:这里不免会联想到高中学的排列组合,但这里并不能用排列组合解决问题。这里其实不难,用三层循环,去掉不合要求的就行了public static void main(String[] args) { int cont = 0;//用来计数 ... 阅读全文
posted @ 2018-07-24 15:01 张明洋 阅读(369) 评论(0) 推荐(0)
摘要:public static void main(String[] args) { //2 打印出所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身。 // 例如:153是一个"水仙花数",因为153=1... 阅读全文
posted @ 2018-07-24 14:58 张明洋 阅读(108) 评论(0) 推荐(0)
摘要:import java.util.Scanner;public class year { public static void main(String[] args) { Scanner sc=new Scanner(System.in); ... 阅读全文
posted @ 2018-07-24 14:55 张明洋 阅读(237) 评论(0) 推荐(0)
摘要:public class number { public static void main(String[] args) { int i = 0; int sum = 0; while(i<201){ ... 阅读全文
posted @ 2018-07-24 14:48 张明洋 阅读(947) 评论(0) 推荐(0)