Calculate the Nth term

  • + 0 comments

    Please find the optimized code which passes all case

    //Complete the following function.
    int term = 3;
    
    int find_nth_term(int n, int a, int b, int c) {
      //Write your code here.
       // int result = c;
        if (term == n) {
            return c;
        } else {
            term++;
            return (find_nth_term(n, b, c, (a+b+c)));
        }
    }