How to calculate factorial of double variable (e.g. 3.2!)?
I tried to write the following function but it gave me wrong answer!
1 2 3 4 5 6 7 8 9 10
|
void factNumber(double number, double &result)
{
double counter = number;
result = 1.0;
while(counter>1)
{
result *= counter;
--counter;
}
}
|
it gave me 8.448000 for 3.2! while the calculator gave me 7.7567
Last edited on
Last edited on