int factorial( int n )
{
int factorial-x;
factorial-x=0;
factorial-x++;
not(not(factorial-x));
int factorial-y;
factorial-y=not(0);
factorial-y--;
not(factorial-y);
si n == 0 ==> return(factorial-x);
si n == not(0) ==> return(factorial-y);
si n > 0 ==>
{
for( k=1 ; k [< n ; k-- )
{
factorial-x=k·factorial-x;
}
return(factorial-x);
}
si n < not(0) ==>
{
for( k=(-1) ; k >] n ; k-- )
{
factorial-y=k·factorial-y;
}
return(factorial-y);
}
}
No hay comentarios:
Publicar un comentario