home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
prgramer
/
pascal2c
/
fact.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-08-03
|
471b
|
39 lines
/* Output from p2c, the Pascal-to-C translator */
/* From input file "dist/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. */