Hi friend,
                   i have sent you a program which calculate the facorial of 
number.
                   if you have any other problem please replay me.

 
---------------------------------
Now that's room service! Choose from over 150,000 hotels 
in 45,000 destinations on Yahoo! Travel to find your fit.
//C++ Program : Factorial of number using recursion

#include<iostream.h>
#include<conio.h>
#include<stdio.h>

int fact(int);

void main()
{
        int num,output;
        clrscr();
        cout<<endl<<"ENTER A NUMBER==> ";
        cin>>num;
        output=fact(num);
        cout<<endl<<"FACTORIAL OF A NUMBER==> "<<output;
        getch();
}

int fact(int n)             //Function definition
{
        int temp;
        if(n==1)
        {
                return(1);
        }
        else
        {
                temp=n*fact(n-1);
        }
        return(temp);
}

Reply via email to