解题思路:
注意事项:
格式错误(仅供参考)
参考代码:
import java.util.Scanner;
public class Main {
public static void main(String[] arg){
@SuppressWarnings("resource")
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
N = N + 1;
int[][] array = new int[N][N];
for(int i = 0;i<array.length;i++){
for(int k=N;k>0;k--){
System.out.print(" ");
}
for(int j=0;j<=i;j++){
array[i][j] = 0;
if(j==0||j==i){
array[i][j]=1;
}
else
array[i][j]=array[i-1][j]+array[i-1][j-1];
if(i!=j){
System.out.print(array[i][j]+" ");
}
else
System.out.print(array[i][j]+" ");
}
N--;
System.out.println();
}
}
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题11.5 (C语言代码)浏览:901 |
不容易系列2 (C语言代码)浏览:597 |
C语言程序设计教程(第三版)课后习题6.10 (C语言代码)浏览:562 |
求组合数 (C语言代码)浏览:1159 |
WU-输出正反三角形 (C++代码)浏览:1021 |
1197求助浏览:631 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:559 |
1392题解(大数相加)浏览:604 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:1200 |
三角形 (C语言代码)浏览:659 |