6. Consider the following recursive function. int Fun ( int n ) if ( n == 4) return 2 else return 2 * Fun ( n + 1 ) end if end Fun What is the value returned by the function call Fun ( 2 ) ?

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 15SA
icon
Related questions
Question
100%
6. Consider the following recursive function.
int Fun ( int n )
if ( n == 4 )
return 2
else
return 2 * Fun ( n + 1 )
end if
end Fun
What is the value returned by the function call Fun ( 2 ) ?
Transcribed Image Text:6. Consider the following recursive function. int Fun ( int n ) if ( n == 4 ) return 2 else return 2 * Fun ( n + 1 ) end if end Fun What is the value returned by the function call Fun ( 2 ) ?
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning