-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrpaskal.java
More file actions
63 lines (48 loc) · 1.39 KB
/
Copy pathrpaskal.java
File metadata and controls
63 lines (48 loc) · 1.39 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
Copyright 2026 Edi (Hadi Gholipour _ AxGooD)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
*/
import java.awt.image.AreaAveragingScaleFilter;
import java.util.Scanner;
public class rpaskal {
private int n;
private int[][] Array;
private Scanner Input;
public rpaskal(){
Input=new Scanner(System.in);
}
public void readN(){
System.out.println("======= Paskal Creation ==========");
System.out.println("Enter Number Rows:");
n = Input.nextInt();
}
public void paskal(){
this.readN();
Array = new int[n][];
for (int i=0; i<n; i++){
Array[i] = new int[i+1];
Array[i][0]= 1;
Array[i][i]= 1;
for (int j=1; j<i; j++){
Array[i][j] = Array[i-1][j-1] + Array[i-1][j];
}
}
print();
}
public void print(){
System.out.println("Paskal Matrix|");
for (int i=0; i<n; i++){
for (int j=0; j<Array[i].length; j++){
System.out.print(Array[i][j]+" ");
}
System.out.println();
}
}
public static void main(String[] args){
rpaskal Start = new rpaskal();
Start.paskal();
}
}