Asked by Dave
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
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
Answers
Answered by
Jordan
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)
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)
Answered by
Dave
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
Thanks
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.