Question: Language: C++ Implement a program that lets the user enter a positive number and then prints the result calculated by the following function. Validate the
Language: C++
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* 31729 8 82 16 100: 10033 1131-108900 The function prototype should be: int recursive(unsigned int n): Example Input: 27 Result: 729
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
