On this mastery I will show you what is recursion in C++ and how to use it.<\/p>\n
Recursion is a form where a function calls itself. When you call the same function, you are doing a loop, and you have to give a condition in order to make this loop stop.<\/p>\n
Let\u2019s create the same program we did on mastery 20<\/a>\u00a0<\/i><\/b>but now using recursion and a function.<\/p>\n So, do as follows:<\/p>\n Your program should look something like this:<\/p>\n Now let\u2019s test the program. Factorial of 5 should be equal to 120.<\/p>\n And that\u2019s about it, you just learned how to use recursion with a function, congrats!<\/p>\n","protected":false},"excerpt":{"rendered":" On this mastery I will show you what is recursion in C++ and how to use it.<\/p>\n Recursion is a form where a function calls itself. When you call the same function, you are doing a loop, and you have to give a condition in order to make this loop stop.<\/p>\n Let’s create the same program we did on mastery 20<\/a> <\/i><\/b>but now using recursion and a function.<\/p>\n So, do as follows:<\/p>\n\n
<\/figure>\n
<\/figure>\n