Saturday
March 25, 2017

Post a New Question

Posted by on .

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

Answer This Question

First Name:
School Subject:
Answer:

Related Questions

More Related Questions

Post a New Question