#include<iostream>
using namespace std;
int fact(int num)
{
if(num==0)
return 1;
else return num*fact(num-1);
}
int main()
{
int n;
cout<<"Enter any number please"<<endl;
cin>>n;
cout<<"factorial is "<<fact(n)<<endl;
}
No comments:
Post a Comment