#include<iostream>
using namespace std;
int fact(int);
int main()
{
int num;
cout<<"ENTER NUMBER"<<endl;
cin>>num;
cout<<"Factorial is "<<fact(num)<<endl;
return 0;
}
int fact(int num)
{
if(num==1 || num==0)
{
return 1;
}
else
{
return num*fact(num-1);
}
}
using namespace std;
int fact(int);
int main()
{
int num;
cout<<"ENTER NUMBER"<<endl;
cin>>num;
cout<<"Factorial is "<<fact(num)<<endl;
return 0;
}
int fact(int num)
{
if(num==1 || num==0)
{
return 1;
}
else
{
return num*fact(num-1);
}
}
No comments:
Post a Comment