Often when we learn programming, we are never taught to think outside the box. Yes, we are given some set of requirements, and a vision of what to build. It is our job as Software Engineers to build that product.
So you folks might have heard of this, famous code to find factorial of a number, the recursive method.
int factorial(int n)
{ int ans = 1; if(n == 0 || n == 1) { return 1; } ans = n * factorial(n-1); return ans;
}
Question: What happens when we enter negative number?
A penny for your thoughts