#include<iostream>
#include<conio.h>
using namespace std;
int fact(int);
main()
{
int num,res=1;
cout<<"Enter Number :";
cin>>num;
res=fact(num);
cout<<"Factorial Is::"<<res;
}
int fact(int x)
{
int res=1;
if(x==1)
return x;
res=x*fact(x-1);
return res;
}
#include<conio.h>
using namespace std;
int fact(int);
main()
{
int num,res=1;
cout<<"Enter Number :";
cin>>num;
res=fact(num);
cout<<"Factorial Is::"<<res;
}
int fact(int x)
{
int res=1;
if(x==1)
return x;
res=x*fact(x-1);
return res;
}
No comments:
Post a Comment