Factorial

This task  was about making a program that asks the user for a non-negative integer and display for them the value of n! (n factorial). After that, it would ask to the user if they would like to try it with another number, in case they answered no the program will wish them a good day and then quit.

There were two options to solve this task: using a loop with an accumulator or a recursive solution. I decided to do something more challenging so I made a recursive solution. But Whats a recursive solution?

A recursive solution is a function that calls itself for getting the answer. For explaning this I found this picture with an example to the problem we are solvingHow recursion works in C++ programming?

So instead of repeating the functions we can call it ilself. (If you want to know more about recursions you should check this link: http://www.programiz.com/cpp-programming/recursion) It was really useful for me to make this task.

Haga click para ver el pase de diapositivas.

That one was my solution, as you can see I had problems at firsts but after making an investigation I found what I was missing and then it work.

You can see my code on GitHub here: Factorial.

Hope this was helpful.

CC BY-SA 4.0 Factorial by martikaglez is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.