Computers

posted by .

Show what the final output of this function will be. The answer will be in the form x * Z - y

Private Function F(x as Int, y As Int, z as Int)
If (y = 1) then
Return 2
Else
Return x * Z - y + F(x-1,y-1, z)
End If
End Function

  • Computers -

    if this is your code

    Private Function F(x as Int, y As Int, z as Int)
    If (y = 1) then
    Return 2
    Else
    Return x * Z - y + F(x-1,y-1, z)
    End If
    End Function

    what is your test data. if you test this code with y=1 then you will get an answer of 2, else Return x * Z - y + F(x-1,y-1, z)

  • Computers -

    The test data I'm using is y = 3. I tried using a trace table, but I get back to 2. Not sure how to get an answer in the form x * Z - y. Any help will be much appreciated.

    Thanks

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. discrete math

    1. let A and B be sets. Show that A U (B - A)=A U B 2. determine whether f is a function from Z to R if a) f(n)= +n b) 1/(n square -4) For 1. B-A is the same as B intersect ~A (That's the complement of A) So A U B = A U (B int ~A) …
  2. Computers

    //program that puts two lists in order in one single list with all the numbers in order import java.util.Scanner; public class listOrder { public static void main (String [] args){ int [] list1; int [] list2; int [] list3; int temp; …
  3. programming

    I really need help in this it makes me confuse.I should make a program to find a pattern...so can somebody help me... Write a function to recognize an pattern within another array. Your function should have the following prototype. …
  4. computer science

    int *reverse(const int *, int); int *temp; temp = reverse(arr1,N); int *reverse(const int *arr1, int N) { int *arr2; arr2 = new int[N]; for(int count = 0; count < N; count++) { for(int index = (N-1); index <= 0; index--) arr2[count] …
  5. computer science

    9.10: Reverse Array Write a function that accepts an int array and the array’s size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should …
  6. computer science

    Im trying to create an arraylist that's sorted but I have no idea how to sort the numbers. I cant use the array.sort method here is my code: public class Testing { private int [] data; private int count; private static int defCapacity …
  7. programming

    m trying to create an arraylist that's sorted but I have no idea how to sort the numbers. I cant use the array.sort method here is my code: public class Testing { private int [] data; private int count; private static int defCapacity …
  8. Calculus

    Integrate x dx/(1-x). I have proceeded thus- Int xdx/(1-x)=int -(x-1+1)/(x-1) =-Int[1+ 1/(x-1)]dx =-Int dx-Int dx/(x-1) =-x-log(x-1). On differentiating, we get original expression- d/dx[-x-log(x-1)]=-1-1/(x-1)=-x/(x-1)=x/(1-x). However, …
  9. computer science

    IHow do you refractor this: public class Employee { private boolean isPartTime; private int seniority; private int monthsDisabled; public Employee(boolean isPartTime, int seniority, int monthsDisabled) { this.isPartTime = isPartTime; …
  10. calculus

    use symmetry to evaluate the double integral (1+x^2siny+y^2sinx)dA, R=[-pi,pi]x[-pi,pi]. let g(x) and h(y) be two functions: int(c to d)int(a to b)(g(x,y)+h(x,y))dxdy=int(c to d)int(a to b)g(x,y)dxdy+int(c to d)int(a to b)h(x,y)dxdy

More Similar Questions