public class Day1206 {
public static void main(String[] args) {
int max = -1;
int a [][] = new int[10][];
for (int i =0;i<a.length;i++){
a[i] = new int[i+1];
}
for (int i =0;i<a.length;i++){
for (int j = 0 ;j<a[i].length;j++){
a[i][j] = (int) (Math.random()*100);
System.out.print(a[i][j]+"\t");
if (a[i][j]>max){
max = a[i][j];
}
}
System.out.println(" ");
}
System.out.println("最大值 :" +max);
}
}
打印随机数字三角形,并输出最大值
最新推荐文章于 2024-09-29 16:46:50 发布