Skip to content

Instantly share code, notes, and snippets.

@dineshrajpurohit
Created February 20, 2015 03:49
Show Gist options
  • Save dineshrajpurohit/8cf43ef44fd7f1ee513c to your computer and use it in GitHub Desktop.
Save dineshrajpurohit/8cf43ef44fd7f1ee513c to your computer and use it in GitHub Desktop.
/**
* Dinesh
*
*/
//package com.dinesh.tutorials;
public static void pascal(int n){
int[][] pas = new int[n][];
for(int i=0; i<n;i++){
pas[i] = new int[i+1];
pas[i][0] = 1;
System.out.print(pas[i][0]+ " ");;
for(int j=1; j<i; j++){
pas[i][j] = pas[i-1][j-1]+pas[i-1][j];
System.out.print(pas[i][j]+" ");
}
pas[i][i] = 1;
System.out.print(pas[i][i]+" ");
System.out.println();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment