Saved Bookmarks
| 1. |
What are recursive function in C++? Give an example. |
|
Answer» : Sum of Natural Numbers USING RecursionExample: Sum of Natural Numbers Using RecursionDuring the next FUNCTION call, 2 is passed to the sum() function. This PROCESS continues until n is EQUAL to 0. When n is equal to 0, the if condition fails and the else part is executed RETURNING the sum of integers ultimately to the main() function. |
|