iv) A Program That Read Two numbers (n,r) & Display nCr (Combination).

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

void main()
{
    int n,r,x;
    clrscr();
    cout<<"Enter 1st number, n = ";
    cin>>n;
    cout<<"Enter 2nd number,r = ";
    cin>>r;

    if(n<=r)
    printf("r must be less than n");
    else
    {
       if(n-r<r)
       x=n-r;
       long int p=1;
       for(int i=1;i<=x;p=p*(n-i+1)/i,i++);

       cout<<n<<"C"<<r<<" = "<<p;
    }

    getch();
}

///////////////////////////////////////////////////////////////////////////
Copy & paste this code in your TC & run, then you will get output.......
If you have any problem please comment below.........