Question: Using c++ Problem 1 Recursion 7 points Implement a program that lets the user enter a positive number and then prints the result calculated by
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 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 1 729 8: 8 2 16 100: 100 3311 3 1 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
