0

I am working on code to calculate the factorial using below function:

int factorial (int num)

{

if (num==1)

return 1;

return factorial(num-1)*num; // recursive call

}

And I need to calculate the numbers from 1 to 255…

The problem occurs when it reaches number 35 and above, it starts to give -1.#IND000 as result for the calculation…

I tried to define the variable as float, double , long double but it doesn’t work!