In accumulation += (pow(input, i))/factorial(i);
you are dividing by 0.
On the factorial function you are missing the case for 0, factorial of 0 is 1.
EDIT: Factorial of 1 is also not 0, you should take a look at that factorial function first before going forward.