Friday, August 19, 2011

Program to find the Factorial of number using Recursion function.

//Program to find the Factorial of number using Recursion function.
#include<stdio.h>
#include<conio.h>
int fact(int n);
void main()
{
int x,temp;
clrscr();
printf("\n \n enter the value of n: ");
scanf("%d",&x);
temp=fact(x);
printf("\n The value of the factorial is %d",temp);
getch();
}
int fact(int n)
{
   int value;
   if(n==1)
    return(n);
   else
   {
     value=n*fact(n-1);
     return(value);
   }
}

Previous Next Home
0 Comments
Comments

Leave a Comment

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Twitter Delicious Facebook Favorites More