Logo Search packages:      
Sourcecode: p2c version File versions  Download package

fact.c

/* Output from p2c --VERSION--, the Pascal-to-C translator */
/* From input file "examples/fact.p" */


#include <p2c/p2c.h>


Static long i;



Static long fact(n)
long n;
{
  if (n > 1)
    return (n * fact(n - 1));
  else
    return 1;
}



main(argc, argv)
int argc;
Char *argv[];
{
  PASCAL_MAIN(argc, argv);
  for (i = 1; i <= 10; i++)
    printf("The factorial of %ld is %ld\n", i, fact(i));
  exit(EXIT_SUCCESS);
}






/* End. */

Generated by  Doxygen 1.6.0   Back to index