Untitled
//LAB 6 #include<iostream> using namespace std; int fact(int n) { if(n==0||n==1) { return 1; } else{ return n*fact(n-1); } } int main() { int n; cout<<"Enter the number : "; cin>>n; cout<<"The factorial of "<<n<<": "<<endl; cout<<fact(n); return 0; }
Leave a Comment