Given the following recursive code. Point out the possible errors in the code.
//num is a positive integer
int fac(int num)
{
if (num≤1) return 1;
else {
return num*fac(num+1);
}
There is no misplaced else.Two round brackets are missing for the return statements.it should have been
return (1)
return (num* fac (num-1))
Note :- it is not (num+1) but (num-1)