Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Pascals-triangle/Java/pascals-triangle-3.java
Normal file
19
Task/Pascals-triangle/Java/pascals-triangle-3.java
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
public class Pascal {
|
||||
private static void printPascalLine (int n) {
|
||||
if (n < 1)
|
||||
return;
|
||||
int m = 1;
|
||||
System.out.print("1 ");
|
||||
for (int j=1; j<n; j++) {
|
||||
m = m * (n-j)/j;
|
||||
System.out.print(m);
|
||||
System.out.print(" ");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
public static void printPascal (int nRows) {
|
||||
for(int i=1; i<=nRows; i++)
|
||||
printPascalLine(i);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue