Quote:
long factorial(int num);
{
{
if(num==0)
return 1;
else
return(num*factorial(num-1);
}
}
Remove the trailing
;
from the first line of the function.
You then have a stray unmatched
(
on the
return
line.
And you have some extra braces within your function which aren't needed.
Also, indent your code properly. It will make it much easier to read.
long factorial(int num)
{
if (num == 0) return 1;
return num * factorial(num-1);
}