Results 1 to 3 of 3
  1. #1
    javasucks2009 is offline Member
    Join Date
    Mar 2009
    Posts
    9
    Rep Power
    0

    Default Please Help me with Java!!!!!!

    hello guys!!! I have some problems with my work cos i dont knw where to start the coding for this question. if anyone would not mind to help me then have a look at the question below:-


    Write a program that sums up the elements of an array of size 11 recursively. Use a recursive method that takes
    as parameters the array and the size of the array. (2 marks)
    // returns the sum of all elements in a[]
    int find Sum ( int a [] , int n )



    thanks

    Andy

  2. #2
    MuslimCoder is offline Senior Member
    Join Date
    Jan 2009
    Posts
    119
    Rep Power
    0

    Default

    here is something that I feel could be correct with a little bit of adjustment...

    Java Code:
      public static int findSum(int[] a, int n)
      {
        
        sum = a[n] + sum(a,n-1);
        
        return sum;
      }

  3. #3
    javasucks2009 is offline Member
    Join Date
    Mar 2009
    Posts
    9
    Rep Power
    0

Posting Permissions

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