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 Sum of GCD over all subarrays
- Calculate the Discriminant Value
- C program to calculate the value of nPr
- Program to calculate value of nCr
- Program to Calculate e^x by Recursion
- Write a program to calculate pow(x,n)
- Program to calculate the value of nCr Efficiently
- Efficient program to calculate e^x
- Program to calculate the value of sin(x) and cos(x) using Expansion
- Calculate area of pentagon with given diagonal
- Program to calculate Root Mean Square
- Calculate speed, distance and time
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.