oxguy3 icon

pascals triangle

oxguy3 | PRO | 03/03/14 05:55:37 PM UTC | 0 ⭐ | 382 👁️ | Never ⏰ | []
Java |

720 B

|

None

|

0 👍

/

0 👎

package org._7hills.schifhay14.apcs;
 
/**
 * @author Hayden Schiff
 * @version March 3, 2014
 * @assign.ment APCS Ch. 8 Recursion problems
 * @descrip.tion Programming Project #8.9
 * 
 * Generates the Nth line of a Pascal's Triangle
 */
 
public class PascalsTriangle {
 
    public static void main(String[] args) {
        
    }
    
    public static int[] getTriangleRow(int row) {
        if (row==1) {
            int[] theRow = {1};
            return theRow;
        }
        if (row==2) {
            int[] theRow = {1, 1};
            return theRow;
        }
        if (row==3) {
            int[] theRow = {1, 2, 1};
            return theRow;
        }
        
        int[] rowAbove = getTriangleRow(row-1);
        int[] theRow = new int[row];
        for (int i = 0; i < theRow.length; i++) {
            
        }
        
    }
}

Comments