Input: n = 5, r = 3
n! / r! * (n – r)! = 5! / 3! * (2!) = 120 / 12 = 10
Input: n = 7, r = 2
Approach: The idea is to store the Pascal’s triangle in a matrix then the value of nCr will be the value of the cell at nth row and rth column.
Below is the implementation of the above approach:
- Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle
- Biggest Reuleaux Triangle within a Square which is inscribed within a Right angle Triangle
- Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle
- Calculate the Discriminant Value
- Program to calculate the value of sin(x) and cos(x)
- C program to calculate the value of nPr
- Program to calculate value of nCr
- Program to calculate the value of nCr Efficiently
- Write a program to calculate pow(x,n)
- Efficient program to calculate e^x
- Program to calculate Area Of Octagon
- Calculate speed, distance and time
- Program to calculate GST from original and net prices
- Program to calculate Profit Or Loss
- Program to calculate Root Mean Square
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.