bycj.net
当前位置:首页 >> jAvA请从1打印到100,共如下: 1 2 3 4 5 6 7 8 9 10... >>

jAvA请从1打印到100,共如下: 1 2 3 4 5 6 7 8 9 10...

与次对角平行的元素个数从左上到右下是递增的;每一条平行线上元素的行列数之和相等. 利用以上两条规律很易编制程序!

1.将这10个数字依次存入到list中2.调用collection的shuffle方法 此后list中数字的顺序就被打乱了

1+2=3 3-3=0 0+4=4 4-5=-1 -1+6=5 5-7=-2 -2+8=6 6-9=-3 -3+10=7 7-11=-4 -4+12=8 8-13=-5 -5+14=9 9-15=-6 -6+16=10 希望能帮到你 望采纳 谢谢

public static void main(String[] args) { String[] a = {"1","2","3","4","5","6","7","8","9","10","j","q","k"}; String[] b = new String[4]; int n = a.length; for(int i = 0; i 评论0 0 0

public class Test1 {public static void main(String[] args) {int[][] array = new int[4][4];int index = 1;for (int col = 0; col < 4; col++) {for (int row = 0; row <= col; row++) {array[row][col] = index++;}}for (int row = 0; row < 4; row++) {for (int col = 0; col < 4; col++)

public class test { public static void main(string[] args) { for (int i = 1; i system.out.print(i+" "); if (i%10 == 0) { system.out.println(); } } } } 附结果1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

public class juzhen { public static void main(string[] args) { int[][] aa = new int[4][5]; for(int i=1;i for(int j=1;j aa[i-1][j-1] = i*j; } } for(int i=0;i for(int j=0;j system.out.print(aa[i][j]+" "); } system.out.println(); } } }

我用的java语言,代码如下:public class Print1to100 { public static void main(String[] args) { for(int i=1;i<=100;i++){ if(i%4==0){ System.out.println(i+"\n"); }else{ System.out.print(i+" "); } } } }结果:1 2 3 45 6 7 89 10 11 1213 14 15 1617 18

循环 挨个数就可以啦

相关文档
网站首页 | 网站地图
All rights reserved Powered by www.bycj.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com