#include<iostream.h>
#include<conio.h>
void main()
{
int n,fact;
int rec(int); clrscr();
cout<<"Enter the number:->";
cin>>n;
fact=rec(n);
cout<<endl<<"Factorial Result are:: "<<fact<<endl;
getch();
}
rec(int x)
{
int f;
if(x==1)
return(x);
else
{
f=x*rec(x-1);
return(f);
}
}
Not Satisfied ? Just search & get the result
Related posts:
- C program to find the factorial of a given number
- Sample – factorial
- Sample – Program to enter a sentence and output the number of uppercase & lowercase consonants, uppercase & lowercase vowels in sentence..
- Sample – Program to convert 2-digit octal number into binary number and print it.
- C program to create a file called emp.rec and store information about a person, in terms of his name, age and salary.
