ItsMods

Full Version: nCr and Factorial Functions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

More random garbage I have just found around my files, I have no idea why I made this things long time ago. Ill probably download MW2 soon Big Grin

Code:
nCr( n, r )
{
    return ( Factorial( n ) / ( Factorial( r ) * Factorial( n - r ) ) );
}

Factorial( number )
{
    fact = 1;
    for( i = 1 ; i <= number ; i ++ )
              fact *= i;
    return fact;
}

http://en.wikipedia.org/wiki/Binomial_coefficient

Thanks for reading Smile
If you mirror this you could make a pyramid of carepackages without the need to set the coordinates yourself (except for one where the pyramid starts).
Inb4 pyramid bunkers incoming, @surtek .

stahp! Troll