内循环累加
来源:互联网 发布:最后的幸存者知临结局 编辑:程序博客网 时间:2024/06/05 17:49
public class Test1 {
public static void main(String[] args) {
int i = 0;
int j = 0;
int s = 0;
int s1 = 0;
int[] k = new int[3];
while (i < 2) {
i++;
while (j < 3) {
j++;
s = (int) (Math.random() * 66);
s1 += s;
k[j - 1] += s;
System.out.println("i=" + i + " j=" + j + " s=" + s + " k="
+ k[j - 1] + " s1=" + s1);
String output = Arrays.toString(k);
System.out.println(output);
// for (int x : k) {
// System.out.print(x + ", ");
// }
// for (int y = 0; y < k.length; y++) {
// if(y < k.length-1){
// System.out.print(k[y] + ", ");
// }else{
// System.out.print(k[y] + "\n");
// }
// }
}
j = 0;
}
}
}
public static void main(String[] args) {
int i = 0;
int j = 0;
int s = 0;
int s1 = 0;
int[] k = new int[3];
while (i < 2) {
i++;
while (j < 3) {
j++;
s = (int) (Math.random() * 66);
s1 += s;
k[j - 1] += s;
System.out.println("i=" + i + " j=" + j + " s=" + s + " k="
+ k[j - 1] + " s1=" + s1);
String output = Arrays.toString(k);
System.out.println(output);
// for (int x : k) {
// System.out.print(x + ", ");
// }
// for (int y = 0; y < k.length; y++) {
// if(y < k.length-1){
// System.out.print(k[y] + ", ");
// }else{
// System.out.print(k[y] + "\n");
// }
// }
}
j = 0;
}
}
}
0 0
- 内循环累加
- for循环练习*累加
- 不用循环实现累加
- 34 用循环累加
- 循环累加远算
- for循环练习(累加思想)
- asp循环表格累加序列号
- C语言:用循环累加
- java中FOR循环实现累加、四则运算
- 第三十四讲|用循环累加
- 34节循环的累加应用
- 第三十四课——循环累加
- C语言第十一篇:循环累加
- 累加算法与循环的使用
- 第三十四讲 项目 用循环累加
- LabVIEW sum累加for循环实例
- 外循环内循环
- 累加
- MyEclipse6.5的速度性能优化大提速(转)
- Expression Blend实例中文教程(9) - 行为快速入门Behaviors
- vim去掉windows文本的多余的回车符(^M)
- oracle中的截取,模糊匹配小结
- myeclipse8.6安装jbpm插件
- 内循环累加
- 题目1117:整数奇偶排序
- 直接拿来用!最火的Android开源项目
- 收藏的Android非常好用的组件或者框架
- JavaScript Promises[转]
- Expression Blend实例中文教程(8) - 动画设计快速入门StoryBoard
- Expression Blend实例中文教程(7) - 动画基础快速入门Animation
- [Unity3D]上海某大型游戏公司的基础面试题
- Linux read 用法