7
Library of functions
- int fact( int n ) {
- int f;
- if ( n < 0 )
- return 0;
- for ( f = 1; n > 1; --n )
- f *= n;
- return f;
- }
- #if !defined( _FACT_H )
- #define _FACT_H
- int fact( int );
- #endif
- #include "fact.h"
- int perm( int n, int k ) {
- int f;
- if ( n < 0 || k < 0 || k > n )
- return 0;
- return fact(n)/fact(n-k);
- }
- #if !defined( _PERM_H )
- #define _PERM_H
- int perm( int, int );
- #endif
Comments