What is nCr Formula?
The nCr represents “n choose r,” a concept in combinatorics that calculates the number of ways to select a group of items from a larger set without considering the order of selection. It is denoted mathematically as:
nCr = n! / (r!(n – r)!)
Where,
- n is the total number of items in the set,
- r is the number of items to be chosen, and
- ! denotes factorial, which is the product of all positive integers from 1 to the given number.
PHP Program to Calculate Combination nCr
This article will show you how to Calculate the Combination nCr in PHP.
Combinations refer to the different ways in which a set of items can be selected without considering the order. In mathematics, the number of combinations of ‘n’ distinct items taken ‘r’ at a time is denoted as nCr. The formula for combinations is nCr = n! / (r! * (n-r)!), where ‘!’ denotes the factorial of a number.