摘要: for(int x = 0;x<3;x++) { System.out.println("x="+x); } int y=0; while(y<3) { System.out.println("y="+y); y++; } System.out.println("y "+y);for/*1.变量有自 阅读全文
posted @ 2020-12-11 17:17 learning365 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 1)l练习1:求和1+2+3+...10 方法一:while int x = 1; while(x<=10) { sum = sum + x; x++; } System.out.println("sum="+sum); 累加思想 原理:通过变量记录住循环操作后的结果 循环注意: 一定明确哪些语句需 阅读全文
posted @ 2020-12-11 17:16 learning365 阅读(1278) 评论(0) 推荐(0) 编辑