Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program Language C++ Problem 1 Recursion 7 points Implement a program that lets the user enter a positive number and then prints the result calculated
Program Language C++
Problem 1 Recursion 7 points Implement a program that lets the user enter a positive number and then prints the result calculated by the following function. Validate the input until a positive integer is entered. Write a recursive function that computes n * n/3 * n/9 *n/27 * n/81 where n is a nonnegative integer, n/x is integer division and the quotient is always a multiple of 3 from the previous quotient. The sequence repeats as long as n/x > 0. For example: 27: 27* 9 * 3* 1729 8: 8 2 16 100: 100 33 * 11 3 * 1 108900 The function prototype should be int recursive(unsigned int n) Example: Input: 27 Result: 729Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started