diff --git a/C++/factorailassgn2.cpp b/C++/factorailassgn2.cpp index ad0c4f2..fcc1e47 100644 --- a/C++/factorailassgn2.cpp +++ b/C++/factorailassgn2.cpp @@ -1,14 +1,17 @@ #include using namespace std; +// recursive function +int fact(int n){ + if(n==1||n==0) + return 1; + int ans; + ans = n*fact(n-1); +} int main() { - int n,i ,fact=1; - cout<<"Enter the no whose factorial is to be find"; - cin>>n; - for(i=1;i<=n;i++) - { - fact=fact*i; - } - cout<<"The focatorial is"<>n; + cout<