title: Pascal's triangle, calculating number at given row and column Java
body: <p>I have a small assignment where I have to produce a pascal triangle and then find a number given a user inputted row and column. This is all I have come up with, I do not know how to proceed with calculating the number at a given row and column.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class PascalTriangle {
  
     public static void print(int n) {
         for (int i = 0; i &lt; n; i++) {
             for (int j = 0; j &lt;= i; j++) {
                 System.out.print(pascal(i, j) + " ");
             }
             System.out.println();
         }
     }
  
     public static int pascal(int i, int j) {
         if (j == 0) {
             return 1;
         } else if (j == i) {
             return 1;
         } else {
             return pascal(i - 1, j - 1) + pascal(i - 1, j);
         }
  
     }
  
     public static void main(String[] args) {
         Scanner scanner = new Scanner(System.in);
         System.out.print("Enter the row number");
         int row = scanner.nextInt();
         print(row);
     }
  }
  </code></pre>