Results 1 to 4 of 4
  1. #1
    hedonist is offline Member
    Join Date
    Jun 2009
    Posts
    35
    Rep Power
    0

    Default Pascals triangle through recursion

    Q. Write a program PascalTriangle that prints the N:th row of Pascalís Triangle. The program should include a recursive method int[] getPascalRow(int n) computing the n:th row of the triangle.

    I have solved this problem through non-recursive method but I got confused with the recursive method.
    Can a recursive method have a return type, int[] in this case?

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    Can a recursive method have a return type, int[] in this case?
    Yes.

  3. #3
    hedonist is offline Member
    Join Date
    Jun 2009
    Posts
    35
    Rep Power
    0

    Default

    Could you please illustrate it.

  4. #4
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    7

    Default

    Java Code:
    int[] method() {
       return new int[4];
    }
    ??

Similar Threads

  1. Triangle
    By jkswebsite in forum New To Java
    Replies: 8
    Last Post: 01-10-2009, 03:08 PM
  2. recursion sierpinskys triangle - HELP!!
    By jrobw in forum Threads and Synchronization
    Replies: 4
    Last Post: 12-08-2008, 06:17 PM
  3. Is it a right triangle? (Code help)
    By TheApostle in forum New To Java
    Replies: 8
    Last Post: 10-07-2008, 09:39 PM
  4. Pascal Triangle help
    By Magic101 in forum New To Java
    Replies: 4
    Last Post: 05-01-2008, 08:51 PM
  5. Making triangle
    By banie in forum New To Java
    Replies: 4
    Last Post: 02-02-2008, 12:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •