解题思路:
注意事项:
格式错误(仅供参考)
参考代码:
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 人评分
IP判断 (C语言代码)浏览:920 |
C语言训练-邮票组合问题* (C语言代码)......浏览:645 |
分糖果 (C++代码)浏览:1438 |
C语言程序设计教程(第三版)课后习题1.6 (C语言代码)浏览:654 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:1415 |
简单的a+b (C语言代码)浏览:807 |
Quadratic Equation (C语言代码)浏览:988 |
C语言考试练习题_一元二次方程 (C++代码)浏览:961 |
1277题解浏览:566 |
多输入输出练习1 (C语言代码)浏览:1437 |