C++ Recursion: Exercises, Practices, Solutions
C++ recursion function[16 exercises with solution]
[An editor is available at the bottom of the page to write and execute the scripts. Go to the editor]
1. Write a C++ program to find the sum of all elements in an array using recursion.
2. Write a C++ program to calculate the factorial of a given number using recursion.
3. Write a C++ program to implement a recursive function to get the nth Fibonacci number.
4. Write a C++ program to implement a recursive function to calculate the sum of digits of a given number.
5. Write a C++ program to implement a recursive function to find the maximum and minimum elements in an array.
6. Write a C++ program to reverse a string using recursion.
7. Write a C++ program to implement a recursive function to calculate the power of a number.
8. Write a C++ program to implement a recursive function to check if a given string is a palindrome.
9. Write a C++ program to implement a recursive function to reverse a linked list.
10. Write a C++ program to implement a recursive function to find the greatest common divisor (GCD) of two numbers.
11. Write a C++ program to implement a recursive function to count the number of occurrences of a specific element in an array of integers.
12. Write a C++ program to implement a recursive function to generate all permutations of a given string.
13. Write a C++ program to implement a recursive function to calculate the product of two numbers without using the multiplication operator.
14. Write a C++ program to implement a recursive function to calculate the sum of even and odd numbers in a given range.
15. Write a C++ program to implement a recursive function to check if a given binary tree is a binary search tree.
16. Write a C++ program to implement a recursive function to find the sum of all prime numbers in a given range.
CPP Code Editor:
More to Come !
Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics