/*---------------------------------------------------*/
/*  Program from lecture to demonstrate functions and recursive functions */
/*  ECL 9/22/08                                      */

#include <stdio.h>

//Function prototypes go here
int fact(int n);
int fact_recurse(int n);

int main(void)
{
	int factorial = 0, n = 0;	//factorial
	printf("Input an integer to find it's factorial value -- ");
	scanf("%i", &n);
	//factorial = fact(n);	//Call the fact function
	printf("\nThe factorial of %i = %i\n", n, fact_recurse(n));	//output number entered and factorial value

	return 0;
}	

int fact(int n)	
{
  int fact = 1;
  while(n>1)
  {
	fact = fact*n;
	n--;
  }//end while block
  return(fact);
}//end fact

int fact_recurse(int n)
{
	int fact = 1;
	if(n > 1)
		fact = n*fact_recurse(n-1);
	return fact;
}










