Here, we will read the value of n and r from the user. Then we will calculate the nCr and print the result.
nCr:
nCr known as the combination is the method of selection of 'r' objects from a set of 'n' objects where the order of selection does not matter.
To find the value of nCr, we use the formula: nCr = n!/[r!( n-r)!]
Program/Source Code:
The source code to calculate the value of nCr is given below. The given program is compiled and executed successfully.
Output:
Explanation:
Here, we read the value of n, r from the user. After that, we calculated the nCr and print the result.
need an explanation for this answer? contact us directly to get an explanation for this answer