Question
What is the output of the call to the mystery function mystery (100);?
What is the output of the call to the mystery func
0 0
Add a comment Improve this question Transcribed image text
Answer #1


public int mystery(int number){
  
   if(number == 0)
       return 1;
   else
       return 1*mystery(number-1);
}

So, lets there is a call: mystery(10)

so, output: 1*mystery(9)
           1*1*mystery(8)
           ------------
           ----------
           1*1*1*....10 times

       So, output = 1, for any value of number > 0

Answer: d. None of the above

Add a comment
Know the answer?
Add Answer to:
What is the output of the call to the mystery function mystery (100);? What is the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT