1. Write a recursive function that returns the nth Fibonacci number from the Fibonacci series. int fib(int n); 2. Write a recursive function to find the factorial of a number. int factorial(int n); 3. Write a recursive function that returns the sum of the digits of an integer. int sumOfDigits(int x); 4. Write a recursive function that find the minimum element in an array of integers. int findMin(int a[], int size); 5. Write a recursive function that converts a decimal number to binary number. int DecToBin(int dec); 6. Write a recursive function that find the sum of the following series. 1 + 1/2 + 1/4 + 1/8 + ... + 1/2n

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 12PE
icon
Related questions
Question
1. Write a recursive function that returns the nth Fibonacci number from the Fibonacci
series.
int fib(int n);

2. Write a recursive function to find the factorial of a number.
int factorial(int n);
3. Write a recursive function that returns the sum of the digits of an integer.
int sumOfDigits(int x);
4. Write a recursive function that find the minimum element in an array of integers.
int findMin(int a[], int size);
5. Write a recursive function that converts a decimal number to binary number.
int DecToBin(int dec);
6. Write a recursive function that find the sum of the following series.
1 + 1/2 + 1/4 + 1/8 + ... + 1/2n
 
Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Declaring and Defining the Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE 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