The double factorial of an odd number n is given by: Check OddDoubleFactorial(15) returns answer = 2027025. Check the answer is calculated using recursion.
Added by Benjamin V.
Step 1
For example, 5!! = 5 * 3 * 1 = 15. Show more…
Show all steps
Your feedback will help us improve your experience
Derek Fairburn and 92 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Verify the factorial formula $$ n !=(n-1)((n-2) !+(n-1) !), \quad(n=2,3,4, \ldots) . $$
Derek F.
The following program segment is designed to calculate the factorial of a nonnegative number $\mathrm{N}$ using recursion. Is the program segment correct? Explain your answer. Modify this program segment to calculate the factorial without using recursion. Be sure that the output values do not change. int fact (int N) if $(N=0)$ return 1 return $N$ in fact $(N-1)$ \}
7. Write a recursive algorithm which takes the input of n (where n is a positive integer) and outputs the value n!. You may not use the factorial function in your algorithm. Prove that your algorithm works.
Sri K.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD