Scanner scanner=new Scanner(System.in);
int a = scanner.nextInt();
System.out.println(a);
int [][]b =new int [a][a];
for(int i=0;i<a;i++){
for(int j=0;j<i+1;j++){
b[i][0]=1;
b[i][i]=1;
if(i!=j&&j!=0){
b[i][j]=b[i-1][j-1]+b[i-1][j];
}
System.out.print(b[i][j]+"\t");
}
System.out.println();
} |
|