3.3

#include<iostream>
using namespace std;
int fact(int n)
{
    if(n==1 || n==0)
        return 1;
    else
        return (n*fact(n-1));
}
int main()
{
    int n,r;
    cout<<"enter the value of n:";
    cin>>n;
    cout<<"enter the value of r:";
    cin>>r;
    double result=(fact(n))/(fact(r)*fact(n-r));
    cout<<"result :"<<result<<endl;
    return 0;
}

Total Pageviews