Untitled
user_7016102
plain_text
2 years ago
286 B
9
Indexable
//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;
}Editor is loading...
Leave a Comment