please dont rip this site

Language Ccpp Cref Examples FACT2.C

/ ***************************************************************************
 *
 * Purpose: generate the factorial of a number by recursion
 * Author:  M. J. Leslie
 * Date:    09-Apr-94
 *
 ***************************************************************************/

#include <stdio.h>

int factorial(int num);

main()
{
  int num;
  puts  ("This program will return the factorial of a number.");
  printf("Please enter the number ==> " );
  scanf("%d", &num);

  printf(" %d! is %d\n",num, factorial(num) );
}

int factorial(int num)
  {
  int ans=1;
  if (num == 1 ) return;
  ans = num * factorial(num-1);
  return ans;
}


file: /Techref/language/ccpp/CREF/EXAMPLES/fact2.c, 0KB, , updated: 1997/4/21 08:52, local time: 2024/11/26 18:32,
TOP NEW HELP FIND: 
3.147.86.246:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/Techref/language/ccpp/CREF/EXAMPLES/fact2.c"> language ccpp CREF EXAMPLES fact2</A>

Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .